Compare commits
353 Commits
hdf5-1_13_
...
hdf5-1_9_2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8be9d9a7e8 | ||
|
|
abecd36aa3 | ||
|
|
c948f9f3f9 | ||
|
|
d90da43810 | ||
|
|
3cd1ab20e5 | ||
|
|
b1b903ac3f | ||
|
|
29bb203283 | ||
|
|
234cbe5c25 | ||
|
|
cb7214b2f7 | ||
|
|
3d62944b04 | ||
|
|
26e403a521 | ||
|
|
6d36ca2303 | ||
|
|
f3b42904a5 | ||
|
|
0fc7dc5b75 | ||
|
|
b4bf98a126 | ||
|
|
6257e2d29a | ||
|
|
130e77f4fa | ||
|
|
39b99473ea | ||
|
|
e36e886cf7 | ||
|
|
85166660d6 | ||
|
|
e5581d39a5 | ||
|
|
d043c9c265 | ||
|
|
e642d17a4d | ||
|
|
6570de93dc | ||
|
|
2dfc4a7ac6 | ||
|
|
87bb643dbb | ||
|
|
524d0abc13 | ||
|
|
287b1fe70f | ||
|
|
442946d6c9 | ||
|
|
7eca206b77 | ||
|
|
d65747d78b | ||
|
|
a2aa6d4e64 | ||
|
|
e0e28a7aae | ||
|
|
65b3bc2a93 | ||
|
|
3f36df51d8 | ||
|
|
76d509dd6f | ||
|
|
50c38a5733 | ||
|
|
f6fbd4ab36 | ||
|
|
3a1c1caa0e | ||
|
|
e5e96cf1fd | ||
|
|
394f6f50bf | ||
|
|
690b832ce1 | ||
|
|
b53d5c485c | ||
|
|
f8f7c0dfaa | ||
|
|
073252b22a | ||
|
|
5d23fe9d97 | ||
|
|
a0acf1329d | ||
|
|
a00ad64f46 | ||
|
|
5a3e6cf080 | ||
|
|
4ddc3c769e | ||
|
|
5cf77a2a7b | ||
|
|
a956537fd3 | ||
|
|
fc31e90ca5 | ||
|
|
44c62d3d0a | ||
|
|
153725d4ba | ||
|
|
b678f28f71 | ||
|
|
7ec8fad952 | ||
|
|
5818a3045d | ||
|
|
d906619ed2 | ||
|
|
ca609fa9a6 | ||
|
|
3f839063e3 | ||
|
|
7e5823d742 | ||
|
|
4890c5327e | ||
|
|
8640a90adb | ||
|
|
a1701cb901 | ||
|
|
08590f3759 | ||
|
|
9158e8aa03 | ||
|
|
67ba5eb6e8 | ||
|
|
02eab2eb72 | ||
|
|
99ceb100fe | ||
|
|
611d2c89af | ||
|
|
720e0c7623 | ||
|
|
519e231710 | ||
|
|
94d9aa2d31 | ||
|
|
07e3ae1f52 | ||
|
|
43845ae14d | ||
|
|
c31111a5f0 | ||
|
|
33d24d6314 | ||
|
|
9dfe3e854f | ||
|
|
612faec1ac | ||
|
|
f5b8c0b3e8 | ||
|
|
f498b5ef45 | ||
|
|
f09d3e86b3 | ||
|
|
2b18e934c6 | ||
|
|
0a9249a401 | ||
|
|
8748d808b2 | ||
|
|
cab8a28fe4 | ||
|
|
3d78e8e656 | ||
|
|
0af52a0cd7 | ||
|
|
93fa2ba196 | ||
|
|
46595a3276 | ||
|
|
308880e894 | ||
|
|
febb17322b | ||
|
|
b212ce0d85 | ||
|
|
3271e8f53a | ||
|
|
2e5abcc03a | ||
|
|
20b35ab1eb | ||
|
|
d8a0a14591 | ||
|
|
66921438dd | ||
|
|
1220779c31 | ||
|
|
4df44aafaf | ||
|
|
f9486b531f | ||
|
|
c701a6e452 | ||
|
|
a829c8b69c | ||
|
|
46b8a32c6e | ||
|
|
b8a8b54fda | ||
|
|
e78fbfd2a2 | ||
|
|
3146ddb5c2 | ||
|
|
6631036834 | ||
|
|
147522bb61 | ||
|
|
4d080e50f6 | ||
|
|
8e9a3a200b | ||
|
|
d5923ee4ca | ||
|
|
080a7ebb37 | ||
|
|
297ed85ea1 | ||
|
|
5845fed5cb | ||
|
|
d9517c14af | ||
|
|
4cccb339bc | ||
|
|
e1e913f87c | ||
|
|
eae9a5c1ce | ||
|
|
b3526d3b90 | ||
|
|
6e46183e35 | ||
|
|
d01b40e439 | ||
|
|
a33955d60f | ||
|
|
72931be7e8 | ||
|
|
908c946a23 | ||
|
|
5802eec5d4 | ||
|
|
e962355bda | ||
|
|
a35d6c95a9 | ||
|
|
c7b5d11320 | ||
|
|
30cd06b6e1 | ||
|
|
39a3d4aa3e | ||
|
|
d8b37d28a3 | ||
|
|
3413c2e10f | ||
|
|
0e1e79f0e0 | ||
|
|
14d8e1c2b5 | ||
|
|
6ee0e05fb9 | ||
|
|
94f8991154 | ||
|
|
4ce17c9aa6 | ||
|
|
5185d3a76a | ||
|
|
f56cc4156e | ||
|
|
0b7490e7e4 | ||
|
|
ea1e90f95a | ||
|
|
ebebe2dd93 | ||
|
|
cec83436f2 | ||
|
|
adc36c3b4b | ||
|
|
c481032c1b | ||
|
|
ac0f446734 | ||
|
|
a2aba62fe0 | ||
|
|
55d3172d22 | ||
|
|
751eb7610b | ||
|
|
b624395cca | ||
|
|
ddced9ab1d | ||
|
|
7a6c0fc682 | ||
|
|
5683217169 | ||
|
|
0725d04506 | ||
|
|
ad18b90759 | ||
|
|
dd2207f210 | ||
|
|
75cdc2dedf | ||
|
|
d2f3c1b991 | ||
|
|
d179489d46 | ||
|
|
f5afdf8e2a | ||
|
|
6edac6e2df | ||
|
|
6de27c1497 | ||
|
|
200ff7fa83 | ||
|
|
88ebfc6dcd | ||
|
|
2ada9c8628 | ||
|
|
3427f6b172 | ||
|
|
495b8de002 | ||
|
|
4e44c3b7e2 | ||
|
|
515d6ccc8e | ||
|
|
f517376cca | ||
|
|
cd5ad177a2 | ||
|
|
cd3f42096b | ||
|
|
434643dd4d | ||
|
|
f0e0137b61 | ||
|
|
e0319e8423 | ||
|
|
046f1d7b1f | ||
|
|
3fef275c89 | ||
|
|
2d3bf69c77 | ||
|
|
35f98ad8b6 | ||
|
|
ce04965208 | ||
|
|
c21ceb956c | ||
|
|
f5ebc95d0d | ||
|
|
9786c0e5cb | ||
|
|
1f6cb6f84a | ||
|
|
edebad0e78 | ||
|
|
d5a6223958 | ||
|
|
ebf3d99b95 | ||
|
|
d41e30a716 | ||
|
|
bd26865f7d | ||
|
|
5a722a152a | ||
|
|
0083cfc35b | ||
|
|
542acd43b8 | ||
|
|
eb89d7b53a | ||
|
|
3e468e6ff6 | ||
|
|
73c139e29b | ||
|
|
e2cd000552 | ||
|
|
099b37d073 | ||
|
|
94cf912176 | ||
|
|
d6ecc0d448 | ||
|
|
f4e7559bd2 | ||
|
|
9c0a2b2145 | ||
|
|
79757db4c2 | ||
|
|
727b687ae6 | ||
|
|
25486d5089 | ||
|
|
fc38cc4d36 | ||
|
|
8205a888cb | ||
|
|
1b8033b594 | ||
|
|
a32d6d79a3 | ||
|
|
c7dd9dfb50 | ||
|
|
315eb0a168 | ||
|
|
a9ca88d156 | ||
|
|
8e04644abd | ||
|
|
059db7a4f2 | ||
|
|
d3958ee85c | ||
|
|
cf7f386fd4 | ||
|
|
f1c8df81fa | ||
|
|
63ebb100e4 | ||
|
|
3c470c9db6 | ||
|
|
6747ebd985 | ||
|
|
9de3a84f91 | ||
|
|
ab8cc1c511 | ||
|
|
ae7d45d612 | ||
|
|
c348f9405e | ||
|
|
d68991eec0 | ||
|
|
1a119d500a | ||
|
|
642f392ba3 | ||
|
|
c034336452 | ||
|
|
6742cba572 | ||
|
|
abb9cc9cd8 | ||
|
|
8b07a4a214 | ||
|
|
9c218ea879 | ||
|
|
bcbf482347 | ||
|
|
de3a870bcd | ||
|
|
98754fa9d1 | ||
|
|
29321bcafa | ||
|
|
47073183e3 | ||
|
|
747e7945f9 | ||
|
|
9b4163af53 | ||
|
|
ca7fc8e96a | ||
|
|
b24e2d4dd8 | ||
|
|
9542a0e212 | ||
|
|
4518875853 | ||
|
|
954c91c551 | ||
|
|
8a27e4f4a6 | ||
|
|
97f8b83e2d | ||
|
|
13d61651f8 | ||
|
|
42efc1c2b5 | ||
|
|
3360c3af0c | ||
|
|
5b4d327909 | ||
|
|
9d06256018 | ||
|
|
a4750dfae7 | ||
|
|
dfd01b8331 | ||
|
|
15703817a9 | ||
|
|
d2b87ec47e | ||
|
|
ee5a1e0735 | ||
|
|
feed868771 | ||
|
|
426a3c1204 | ||
|
|
a2a61197aa | ||
|
|
f1360e4d06 | ||
|
|
dfa5cb68c0 | ||
|
|
f75166dd98 | ||
|
|
859507f757 | ||
|
|
b043ee1241 | ||
|
|
6c5e37a593 | ||
|
|
58067df6c7 | ||
|
|
328d540a34 | ||
|
|
7a1fcfa419 | ||
|
|
ff0e403315 | ||
|
|
2f0dd6b249 | ||
|
|
53f99e0966 | ||
|
|
fb984423fc | ||
|
|
dafe255d8a | ||
|
|
52df94498e | ||
|
|
eceb405b87 | ||
|
|
238950487f | ||
|
|
7c22743e8e | ||
|
|
2a07e56c05 | ||
|
|
a7372ec352 | ||
|
|
996c2f8d3b | ||
|
|
2d7fcc8553 | ||
|
|
7bc9c34c55 | ||
|
|
21f8fa203a | ||
|
|
acd5a4278a | ||
|
|
51fd7c574f | ||
|
|
239c45e0f5 | ||
|
|
0d41b14350 | ||
|
|
be4c660148 | ||
|
|
0c8e622e1a | ||
|
|
f383c2a622 | ||
|
|
e117aee161 | ||
|
|
b5c82e2e41 | ||
|
|
441b270234 | ||
|
|
41220f0911 | ||
|
|
84728ecf74 | ||
|
|
918973d9fc | ||
|
|
763e6be682 | ||
|
|
13fde5a0b1 | ||
|
|
ed7658df79 | ||
|
|
879d58b86b | ||
|
|
94594831a9 | ||
|
|
3972bca340 | ||
|
|
3ac720455a | ||
|
|
b941208aa1 | ||
|
|
bae373c322 | ||
|
|
29d45ed0d1 | ||
|
|
e5d0555815 | ||
|
|
e3d0563a73 | ||
|
|
55fbd675c6 | ||
|
|
38e7d90442 | ||
|
|
3417e79f88 | ||
|
|
ebe57002d6 | ||
|
|
0917096d34 | ||
|
|
cb0c04e1d4 | ||
|
|
08677fc32a | ||
|
|
284d51f650 | ||
|
|
db82e34584 | ||
|
|
4c3073f955 | ||
|
|
5bb857476f | ||
|
|
35bbc743d4 | ||
|
|
52fed52f9c | ||
|
|
f4a6b264fd | ||
|
|
1b0aacf4c8 | ||
|
|
0051ab6330 | ||
|
|
b19fbb9e4e | ||
|
|
a29e811343 | ||
|
|
505b31ee08 | ||
|
|
5f2e591745 | ||
|
|
53e4b5b90b | ||
|
|
65dc3358db | ||
|
|
33a65add7d | ||
|
|
e63f0baf7e | ||
|
|
90c3d4e0ca | ||
|
|
3c882637c2 | ||
|
|
4adbc1e1db | ||
|
|
72b4a68953 | ||
|
|
7e67d1f00d | ||
|
|
5436f45bd1 | ||
|
|
cde7807ceb | ||
|
|
2aa344d77a | ||
|
|
2d74d46d3f | ||
|
|
7191f26717 | ||
|
|
2cbd7f1b3c | ||
|
|
f7ae23e639 | ||
|
|
0894356a3c | ||
|
|
e0bb475838 | ||
|
|
2ac77da499 | ||
|
|
596f9b4327 | ||
|
|
de5e1d93e4 | ||
|
|
26a82c3575 | ||
|
|
8625a8bd6b | ||
|
|
0e367c3715 |
18
ACKNOWLEDGMENTS
Normal file
18
ACKNOWLEDGMENTS
Normal file
@@ -0,0 +1,18 @@
|
||||
Acknowledgments - November 2010
|
||||
-------------------------------
|
||||
|
||||
We would like to thank the following people who have contributed directly
|
||||
or indirectly to HDF5:
|
||||
|
||||
Werner Benger, for contributing code used to add support for the Windows
|
||||
Threading library included in the 1.8.6 release.
|
||||
|
||||
John A. Biddiscombe, Mike Jackson, and Sean McBride for contributing and
|
||||
testing CMake code included in the HDF5 1.8.5 distribution.
|
||||
|
||||
The HDF5 community for helping shape the development of HDF5 by contributing
|
||||
bug reports and patches, joining in on forum discussions, and continually
|
||||
supporting our software.
|
||||
|
||||
Finally, we'd like to thank all organizations whose funding has made HDF5
|
||||
possible.
|
||||
113
CMakeFilters.cmake
Normal file
113
CMakeFilters.cmake
Normal file
@@ -0,0 +1,113 @@
|
||||
|
||||
include (ExternalProject)
|
||||
#option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO SVN TGZ)" "NO")
|
||||
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)")
|
||||
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
|
||||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
option (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 1)
|
||||
option (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 1)
|
||||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
|
||||
set (ZLIB_URL ${ZLIB_SVN_URL} CACHE STRING "Path to zlib Subversion repository")
|
||||
set (SZIP_URL ${SZIP_SVN_URL} CACHE STRING "Path to szip Subversion repository")
|
||||
elseif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
if (NOT TGZPATH)
|
||||
set (TGZPATH ${HDF5_SOURCE_DIR})
|
||||
endif (NOT TGZPATH)
|
||||
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
|
||||
set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
|
||||
else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
|
||||
set (ZLIB_USE_EXTERNAL 0)
|
||||
set (SZIP_USE_EXTERNAL 0)
|
||||
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
|
||||
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for ZLib support
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF)
|
||||
if (HDF5_ENABLE_Z_LIB_SUPPORT)
|
||||
if (NOT H5_ZLIB_HEADER)
|
||||
if (NOT ZLIB_USE_EXTERNAL)
|
||||
find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
|
||||
if (NOT ZLIB_FOUND)
|
||||
find_package (ZLIB) # Legacy find
|
||||
if (ZLIB_FOUND)
|
||||
set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
|
||||
endif (ZLIB_FOUND)
|
||||
endif (NOT ZLIB_FOUND)
|
||||
endif (NOT ZLIB_USE_EXTERNAL)
|
||||
if (ZLIB_FOUND)
|
||||
set (H5_HAVE_FILTER_DEFLATE 1)
|
||||
set (H5_HAVE_ZLIB_H 1)
|
||||
set (H5_HAVE_LIBZ 1)
|
||||
set (H5_ZLIB_HEADER "zlib.h")
|
||||
set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
|
||||
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
||||
else (ZLIB_FOUND)
|
||||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
|
||||
set (H5_HAVE_FILTER_DEFLATE 1)
|
||||
set (H5_HAVE_ZLIB_H 1)
|
||||
set (H5_HAVE_LIBZ 1)
|
||||
message (STATUS "Filter ZLIB is built")
|
||||
else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
message (FATAL_ERROR " ZLib is Required for ZLib support in HDF5")
|
||||
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
endif (ZLIB_FOUND)
|
||||
else (NOT H5_ZLIB_HEADER)
|
||||
# This project is being called from within another and ZLib is already configured
|
||||
set (H5_HAVE_FILTER_DEFLATE 1)
|
||||
set (H5_HAVE_ZLIB_H 1)
|
||||
set (H5_HAVE_LIBZ 1)
|
||||
endif (NOT H5_ZLIB_HEADER)
|
||||
if (H5_HAVE_FILTER_DEFLATE)
|
||||
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DEFLATE")
|
||||
endif (H5_HAVE_FILTER_DEFLATE)
|
||||
set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
|
||||
message (STATUS "Filter ZLIB is ON")
|
||||
endif (HDF5_ENABLE_Z_LIB_SUPPORT)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for SzLib support
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF)
|
||||
if (HDF5_ENABLE_SZIP_SUPPORT)
|
||||
option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
|
||||
if (NOT SZIP_USE_EXTERNAL)
|
||||
find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT})
|
||||
if (NOT SZIP_FOUND)
|
||||
find_package (SZIP) # Legacy find
|
||||
if (SZIP_FOUND)
|
||||
set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
|
||||
endif (SZIP_FOUND)
|
||||
endif (NOT SZIP_FOUND)
|
||||
endif (NOT SZIP_USE_EXTERNAL)
|
||||
if (SZIP_FOUND)
|
||||
set (H5_HAVE_FILTER_SZIP 1)
|
||||
set (H5_HAVE_SZLIB_H 1)
|
||||
set (H5_HAVE_LIBSZ 1)
|
||||
set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
|
||||
set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
|
||||
else (SZIP_FOUND)
|
||||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE} ${HDF5_ENABLE_SZIP_ENCODING})
|
||||
set (H5_HAVE_FILTER_SZIP 1)
|
||||
set (H5_HAVE_SZLIB_H 1)
|
||||
set (H5_HAVE_LIBSZ 1)
|
||||
message (STATUS "Filter SZIP is built")
|
||||
else (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5")
|
||||
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
endif (SZIP_FOUND)
|
||||
set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
|
||||
message (STATUS "Filter SZIP is ON")
|
||||
if (H5_HAVE_FILTER_SZIP)
|
||||
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE")
|
||||
endif (H5_HAVE_FILTER_SZIP)
|
||||
if (HDF5_ENABLE_SZIP_ENCODING)
|
||||
set (H5_HAVE_SZIP_ENCODER 1)
|
||||
set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} ENCODE")
|
||||
endif (HDF5_ENABLE_SZIP_ENCODING)
|
||||
endif (HDF5_ENABLE_SZIP_SUPPORT)
|
||||
631
CMakeInstallation.cmake
Normal file
631
CMakeInstallation.cmake
Normal file
@@ -0,0 +1,631 @@
|
||||
include (CMakePackageConfigHelpers)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check for Installation Utilities
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
set (PF_ENV_EXT "(x86)")
|
||||
find_program (NSIS_EXECUTABLE NSIS.exe PATHS "$ENV{ProgramFiles}\\NSIS" "$ENV{ProgramFiles${PF_ENV_EXT}}\\NSIS")
|
||||
if(NOT CPACK_WIX_ROOT)
|
||||
file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
|
||||
endif()
|
||||
find_program (WIX_EXECUTABLE candle PATHS "${CPACK_WIX_ROOT}/bin")
|
||||
endif (WIN32)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add file(s) to CMake Install
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/H5pubconf.h
|
||||
DESTINATION ${HDF5_INSTALL_INCLUDE_DIR}
|
||||
COMPONENT headers
|
||||
)
|
||||
endif (NOT HDF5_INSTALL_NO_DEVELOPMENT)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target(s) to CMake Install for import into other projects
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
install (
|
||||
EXPORT ${HDF5_EXPORTED_TARGETS}
|
||||
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}
|
||||
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
|
||||
COMPONENT configinstall
|
||||
)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Export all exported targets to the build tree for use by parent project
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
export (
|
||||
TARGETS ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES}
|
||||
FILE ${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
|
||||
)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set includes needed for build
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF5_INCLUDES_BUILD_TIME
|
||||
${HDF5_SRC_DIR} ${HDF5_CPP_SRC_DIR} ${HDF5_HL_SRC_DIR}
|
||||
${HDF5_TOOLS_SRC_DIR} ${HDF5_BINARY_DIR}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set variables needed for installation
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF5_VERSION_STRING ${HDF5_PACKAGE_VERSION})
|
||||
set (HDF5_VERSION_MAJOR ${HDF5_PACKAGE_VERSION_MAJOR})
|
||||
set (HDF5_VERSION_MINOR ${HDF5_PACKAGE_VERSION_MINOR})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the hdf5-config.cmake file for the build directory
|
||||
#-----------------------------------------------------------------------------
|
||||
set (INCLUDE_INSTALL_DIR ${HDF5_INSTALL_INCLUDE_DIR})
|
||||
set (SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_INSTALL_CMAKE_DIR}" )
|
||||
set (CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
|
||||
configure_package_config_file (
|
||||
${HDF_RESOURCES_DIR}/hdf5-config.cmake.in
|
||||
"${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake"
|
||||
INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}"
|
||||
PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
|
||||
INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the FindHDF5.cmake file for the install directory
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
configure_file (
|
||||
${HDF_RESOURCES_DIR}/FindHDF5.cmake.in
|
||||
${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindHDF5${HDF_PACKAGE_EXT}.cmake @ONLY
|
||||
)
|
||||
install (
|
||||
FILES ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindHDF5${HDF_PACKAGE_EXT}.cmake
|
||||
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}
|
||||
COMPONENT configinstall
|
||||
)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the hdf5-config.cmake file for the install directory
|
||||
#-----------------------------------------------------------------------------
|
||||
set (INCLUDE_INSTALL_DIR ${HDF5_INSTALL_INCLUDE_DIR})
|
||||
set (SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${HDF5_INSTALL_CMAKE_DIR}" )
|
||||
set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" )
|
||||
configure_package_config_file (
|
||||
${HDF_RESOURCES_DIR}/hdf5-config.cmake.in
|
||||
"${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake"
|
||||
INSTALL_DESTINATION "${HDF5_INSTALL_CMAKE_DIR}"
|
||||
PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
|
||||
)
|
||||
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
install (
|
||||
FILES ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake
|
||||
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}
|
||||
COMPONENT configinstall
|
||||
)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the hdf5-config-version .cmake file for the install directory
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
configure_file (
|
||||
${HDF_RESOURCES_DIR}/hdf5-config-version.cmake.in
|
||||
${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
|
||||
)
|
||||
install (
|
||||
FILES ${HDF5_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
|
||||
DESTINATION ${HDF5_INSTALL_CMAKE_DIR}
|
||||
COMPONENT configinstall
|
||||
)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the libhdf5.settings file for the lib info
|
||||
#-----------------------------------------------------------------------------
|
||||
if (H5_WORDS_BIGENDIAN)
|
||||
set (BYTESEX big-endian)
|
||||
else (H5_WORDS_BIGENDIAN)
|
||||
set (BYTESEX little-endian)
|
||||
endif (H5_WORDS_BIGENDIAN)
|
||||
configure_file (
|
||||
${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in
|
||||
${HDF5_BINARY_DIR}/libhdf5.settings @ONLY
|
||||
)
|
||||
install (
|
||||
FILES ${HDF5_BINARY_DIR}/libhdf5.settings
|
||||
DESTINATION ${HDF5_INSTALL_LIB_DIR}
|
||||
COMPONENT libraries
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Create pkgconfig files
|
||||
#-----------------------------------------------------------------------------
|
||||
#foreach (libs ${LINK_LIBS})
|
||||
# set (LIBS "${LIBS} -l${libs}")
|
||||
#endforeach (libs ${LINK_LIBS})
|
||||
#foreach (libs ${HDF5_LIBRARIES_TO_EXPORT})
|
||||
# set (HDF5LIBS "${HDF5LIBS} -l${libs}")
|
||||
#endforeach (libs ${HDF5_LIBRARIES_TO_EXPORT})
|
||||
#configure_file (
|
||||
# ${HDF_RESOURCES_DIR}/libhdf5.pc.in
|
||||
# ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc @ONLY
|
||||
#)
|
||||
#install (
|
||||
# FILES ${HDF5_BINARY_DIR}/CMakeFiles/libhdf5.pc
|
||||
# DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig
|
||||
#)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the HDF518_Examples.cmake file and the examples
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF)
|
||||
if (HDF5_PACK_EXAMPLES)
|
||||
configure_file (
|
||||
${HDF_RESOURCES_DIR}/HDF518_Examples.cmake.in
|
||||
${HDF5_BINARY_DIR}/HDF518_Examples.cmake @ONLY
|
||||
)
|
||||
install (
|
||||
FILES ${HDF5_BINARY_DIR}/HDF518_Examples.cmake
|
||||
DESTINATION ${HDF5_INSTALL_DATA_DIR}
|
||||
COMPONENT hdfdocuments
|
||||
)
|
||||
if (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}
|
||||
)
|
||||
install (
|
||||
DIRECTORY ${HDF5_BINARY_DIR}/HDF5Examples-0.1.1-Source
|
||||
DESTINATION ${HDF5_INSTALL_DATA_DIR}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
COMPONENT hdfdocuments
|
||||
)
|
||||
install (
|
||||
FILES
|
||||
${HDF5_SOURCE_DIR}/release_docs/USING_CMake_Examples.txt
|
||||
DESTINATION ${HDF5_INSTALL_DATA_DIR}
|
||||
COMPONENT hdfdocuments
|
||||
)
|
||||
endif (EXISTS "${HDF5_EXAMPLES_COMPRESSED_DIR}/${HDF5_EXAMPLES_COMPRESSED}")
|
||||
endif (HDF5_PACK_EXAMPLES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the README.txt file for the binary package
|
||||
#-----------------------------------------------------------------------------
|
||||
HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the COPYING.txt file for the windows binary package
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
configure_file (${HDF5_SOURCE_DIR}/COPYING ${HDF5_BINARY_DIR}/COPYING.txt @ONLY)
|
||||
endif (WIN32)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Document File(s) to CMake Install
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
install (
|
||||
FILES
|
||||
${HDF5_SOURCE_DIR}/COPYING
|
||||
DESTINATION ${HDF5_INSTALL_DATA_DIR}
|
||||
COMPONENT hdfdocuments
|
||||
)
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs")
|
||||
set (release_files
|
||||
${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_CMake.txt
|
||||
${HDF5_SOURCE_DIR}/release_docs/COPYING
|
||||
${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt
|
||||
)
|
||||
if (WIN32)
|
||||
set (release_files
|
||||
${release_files}
|
||||
${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_VS.txt
|
||||
)
|
||||
endif (WIN32)
|
||||
if (HDF5_PACK_INSTALL_DOCS)
|
||||
set (release_files
|
||||
${release_files}
|
||||
${HDF5_SOURCE_DIR}/release_docs/INSTALL_CMake.txt
|
||||
${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt
|
||||
${HDF5_SOURCE_DIR}/release_docs/INSTALL
|
||||
)
|
||||
if (WIN32)
|
||||
set (release_files
|
||||
${release_files}
|
||||
${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt
|
||||
)
|
||||
endif (WIN32)
|
||||
if (CYGWIN)
|
||||
set (release_files
|
||||
${release_files}
|
||||
${HDF5_SOURCE_DIR}/release_docs/INSTALL_Cygwin.txt
|
||||
)
|
||||
endif (CYGWIN)
|
||||
if (HDF5_ENABLE_PARALLEL)
|
||||
set (release_files
|
||||
${release_files}
|
||||
${HDF5_SOURCE_DIR}/release_docs/INSTALL_parallel
|
||||
)
|
||||
endif (HDF5_ENABLE_PARALLEL)
|
||||
endif (HDF5_PACK_INSTALL_DOCS)
|
||||
install (
|
||||
FILES ${release_files}
|
||||
DESTINATION ${HDF5_INSTALL_DATA_DIR}
|
||||
COMPONENT hdfdocuments
|
||||
)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs")
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
if (CMAKE_HOST_UNIX)
|
||||
set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}"
|
||||
CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
|
||||
else (CMAKE_HOST_UNIX)
|
||||
GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
|
||||
set (CMAKE_INSTALL_PREFIX
|
||||
"${CMAKE_GENERIC_PROGRAM_FILES}/HDF_Group/${HDF5_PACKAGE_NAME}/${HDF5_PACKAGE_VERSION}"
|
||||
CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
|
||||
set (CMAKE_GENERIC_PROGRAM_FILES)
|
||||
endif (CMAKE_HOST_UNIX)
|
||||
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set the cpack variables
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES)
|
||||
set (CPACK_PACKAGE_VENDOR "HDF_Group")
|
||||
set (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}")
|
||||
if (CDASH_LOCAL)
|
||||
set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}")
|
||||
else (CDASH_LOCAL)
|
||||
set (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION_STRING}")
|
||||
endif (CDASH_LOCAL)
|
||||
set (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}")
|
||||
set (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}")
|
||||
set (CPACK_PACKAGE_VERSION_PATCH "")
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/release_docs")
|
||||
set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt")
|
||||
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING")
|
||||
set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt")
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/release_docs")
|
||||
set (CPACK_PACKAGE_RELOCATABLE TRUE)
|
||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
|
||||
set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp")
|
||||
|
||||
set (CPACK_GENERATOR "TGZ")
|
||||
if (WIN32)
|
||||
set (CPACK_GENERATOR "ZIP")
|
||||
|
||||
if (NSIS_EXECUTABLE)
|
||||
list (APPEND CPACK_GENERATOR "NSIS")
|
||||
endif (NSIS_EXECUTABLE)
|
||||
# Installers for 32- vs. 64-bit CMake:
|
||||
# - Root install directory (displayed to end user at installer-run time)
|
||||
# - "NSIS package/display name" (text used in the installer GUI)
|
||||
# - Registry key used to store info about the installation
|
||||
set (CPACK_NSIS_PACKAGE_NAME "${HDF5_PACKAGE_STRING}")
|
||||
if (CMAKE_CL_64)
|
||||
set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
|
||||
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION} (Win64)")
|
||||
else (CMAKE_CL_64)
|
||||
set (CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
||||
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
endif (CMAKE_CL_64)
|
||||
# set the install/unistall icon used for the installer itself
|
||||
# There is a bug in NSI that does not handle full unix paths properly.
|
||||
set (CPACK_NSIS_MUI_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico")
|
||||
set (CPACK_NSIS_MUI_UNIICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico")
|
||||
# set the package header icon for MUI
|
||||
set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.bmp")
|
||||
set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}")
|
||||
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}")
|
||||
set (CPACK_NSIS_CONTACT "${HDF5_PACKAGE_BUGREPORT}")
|
||||
set (CPACK_NSIS_MODIFY_PATH ON)
|
||||
|
||||
if (WIX_EXECUTABLE)
|
||||
list (APPEND CPACK_GENERATOR "WIX")
|
||||
endif (WIX_EXECUTABLE)
|
||||
#WiX variables
|
||||
set (CPACK_WIX_UNINSTALL "1")
|
||||
# .. variable:: CPACK_WIX_LICENSE_RTF
|
||||
# RTF License File
|
||||
#
|
||||
# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension it is used as-is.
|
||||
#
|
||||
# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension it is implicitly
|
||||
# converted to RTF by the WiX Generator.
|
||||
# The expected encoding of the .txt file is UTF-8.
|
||||
#
|
||||
# With CPACK_WIX_LICENSE_RTF you can override the license file used by the
|
||||
# WiX Generator in case CPACK_RESOURCE_FILE_LICENSE is in an unsupported
|
||||
# format or the .txt -> .rtf conversion does not work as expected.
|
||||
set (CPACK_RESOURCE_FILE_LICENSE "${HDF5_BINARY_DIR}/COPYING.txt")
|
||||
# .. variable:: CPACK_WIX_PRODUCT_ICON
|
||||
# The Icon shown next to the program name in Add/Remove programs.
|
||||
set(CPACK_WIX_PRODUCT_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.ico")
|
||||
#
|
||||
# .. variable:: CPACK_WIX_UI_BANNER
|
||||
#
|
||||
# The bitmap will appear at the top of all installer pages other than the
|
||||
# welcome and completion dialogs.
|
||||
#
|
||||
# If set, this image will replace the default banner image.
|
||||
#
|
||||
# This image must be 493 by 58 pixels.
|
||||
#
|
||||
# .. variable:: CPACK_WIX_UI_DIALOG
|
||||
#
|
||||
# Background bitmap used on the welcome and completion dialogs.
|
||||
#
|
||||
# If this variable is set, the installer will replace the default dialog
|
||||
# image.
|
||||
#
|
||||
# This image must be 493 by 312 pixels.
|
||||
#
|
||||
set(CPACK_WIX_PROPERTY_ARPCOMMENTS "HDF5 (Hierarchical Data Format 5) Software Library and Utilities")
|
||||
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "${HDF5_PACKAGE_URL}")
|
||||
set(CPACK_WIX_PROPERTY_ARPHELPLINK "${HDF5_PACKAGE_BUGREPORT}")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(CPACK_WIX_PATCH_FILE "${HDF_RESOURCES_DIR}/patch.xml")
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
elseif (APPLE)
|
||||
list (APPEND CPACK_GENERATOR "DragNDrop")
|
||||
set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
|
||||
set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
||||
set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns")
|
||||
|
||||
option (HDF5_PACK_MACOSX_BUNDLE "Package the HDF5 Library in a Bundle" OFF)
|
||||
if (HDF5_PACK_MACOSX_BUNDLE)
|
||||
list (APPEND CPACK_GENERATOR "Bundle")
|
||||
set (CPACK_BUNDLE_NAME "${HDF5_PACKAGE_STRING}")
|
||||
set (CPACK_BUNDLE_LOCATION "/") # make sure CMAKE_INSTALL_PREFIX ends in /
|
||||
set (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/")
|
||||
set (CPACK_BUNDLE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns")
|
||||
set (CPACK_BUNDLE_PLIST "${HDF5_BINARY_DIR}/CMakeFiles/Info.plist")
|
||||
set (CPACK_APPLE_GUI_INFO_STRING "HDF5 (Hierarchical Data Format 5) Software Library and Utilities")
|
||||
set (CPACK_APPLE_GUI_COPYRIGHT "Copyright © 2006-2015 by The HDF Group. All rights reserved.")
|
||||
set (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}")
|
||||
set (CPACK_APPLE_GUI_BUNDLE_NAME "${HDF5_PACKAGE_STRING}")
|
||||
set (CPACK_APPLE_GUI_VERSION_STRING "${CPACK_PACKAGE_VERSION_STRING}")
|
||||
set (CPACK_APPLE_GUI_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the Info.plist file for the install bundle
|
||||
#-----------------------------------------------------------------------------
|
||||
configure_file (
|
||||
${HDF_RESOURCES_EXT_DIR}/CPack.Info.plist.in
|
||||
${HDF5_BINARY_DIR}/CMakeFiles/Info.plist @ONLY
|
||||
)
|
||||
configure_file (
|
||||
${HDF_RESOURCES_DIR}/PkgInfo.in
|
||||
${HDF5_BINARY_DIR}/CMakeFiles/PkgInfo @ONLY
|
||||
)
|
||||
configure_file (
|
||||
${HDF_RESOURCES_EXT_DIR}/version.plist.in
|
||||
${HDF5_BINARY_DIR}/CMakeFiles/version.plist @ONLY
|
||||
)
|
||||
install (
|
||||
FILES ${HDF5_BINARY_DIR}/CMakeFiles/PkgInfo
|
||||
${HDF5_BINARY_DIR}/CMakeFiles/version.plist
|
||||
DESTINATION ..
|
||||
)
|
||||
endif (HDF5_PACK_MACOSX_BUNDLE)
|
||||
else (WIN32)
|
||||
list (APPEND CPACK_GENERATOR "STGZ")
|
||||
set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}")
|
||||
set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
|
||||
|
||||
set (CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
|
||||
set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${HDF5_PACKAGE_BUGREPORT}")
|
||||
|
||||
# list (APPEND CPACK_GENERATOR "RPM")
|
||||
set (CPACK_RPM_PACKAGE_RELEASE "1")
|
||||
set (CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
set (CPACK_RPM_PACKAGE_RELOCATABLE ON)
|
||||
set (CPACK_RPM_PACKAGE_LICENSE "BSD-style")
|
||||
set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
|
||||
set (CPACK_RPM_PACKAGE_URL "${HDF5_PACKAGE_URL}")
|
||||
set (CPACK_RPM_PACKAGE_SUMMARY "HDF5 is a unique technology suite that makes possible the management of extremely large and complex data collections.")
|
||||
set (CPACK_RPM_PACKAGE_DESCRIPTION
|
||||
"The HDF5 technology suite includes:
|
||||
|
||||
* A versatile data model that can represent very complex data objects and a wide variety of metadata.
|
||||
|
||||
* A completely portable file format with no limit on the number or size of data objects in the collection.
|
||||
|
||||
* A software library that runs on a range of computational platforms, from laptops to massively parallel systems, and implements a high-level API with C, C++, Fortran 90, and Java interfaces.
|
||||
|
||||
* A rich set of integrated performance features that allow for access time and storage space optimizations.
|
||||
|
||||
* Tools and applications for managing, manipulating, viewing, and analyzing the data in the collection.
|
||||
|
||||
The HDF5 data model, file format, API, library, and tools are open and distributed without charge.
|
||||
"
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the spec file for the install RPM
|
||||
#-----------------------------------------------------------------------------
|
||||
# configure_file ("${HDF5_RESOURCES_DIR}/hdf5.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec" @ONLY IMMEDIATE)
|
||||
# set (CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec")
|
||||
endif (WIN32)
|
||||
|
||||
# By default, do not warn when built on machines using only VS Express:
|
||||
if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
||||
set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||
endif (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
||||
include (InstallRequiredSystemLibraries)
|
||||
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${HDF5_BINARY_DIR};HDF5;ALL;/")
|
||||
|
||||
if (HDF5_PACKAGE_EXTLIBS)
|
||||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
|
||||
if (WIN32)
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;ALL;/")
|
||||
else (WIN32)
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/")
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;headers;/")
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;configinstall;/")
|
||||
endif (WIN32)
|
||||
endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
|
||||
if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
|
||||
if (WIN32)
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/")
|
||||
else (WIN32)
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/")
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;headers;/")
|
||||
set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/")
|
||||
endif (WIN32)
|
||||
endif (SZIP_FOUND AND SZIP_USE_EXTERNAL)
|
||||
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
endif (HDF5_PACKAGE_EXTLIBS)
|
||||
|
||||
include (CPack)
|
||||
|
||||
cpack_add_install_type(Full DISPLAY_NAME "Everything")
|
||||
cpack_add_install_type(Developer)
|
||||
|
||||
cpack_add_component_group(Runtime)
|
||||
|
||||
cpack_add_component_group(Documents
|
||||
EXPANDED
|
||||
DESCRIPTION "Release notes for developing HDF5 applications"
|
||||
)
|
||||
|
||||
cpack_add_component_group(Development
|
||||
EXPANDED
|
||||
DESCRIPTION "All of the tools you'll need to develop HDF5 applications"
|
||||
)
|
||||
|
||||
cpack_add_component_group(Applications
|
||||
EXPANDED
|
||||
DESCRIPTION "Tools for HDF5 files"
|
||||
)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Now list the cpack commands
|
||||
#---------------------------------------------------------------------------
|
||||
CPACK_ADD_COMPONENT (libraries
|
||||
DISPLAY_NAME "HDF5 Libraries"
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (headers
|
||||
DISPLAY_NAME "HDF5 Headers"
|
||||
DEPENDS libraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
CPACK_ADD_COMPONENT (hdfdocuments
|
||||
DISPLAY_NAME "HDF5 Documents"
|
||||
GROUP Documents
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
CPACK_ADD_COMPONENT (configinstall
|
||||
DISPLAY_NAME "HDF5 CMake files"
|
||||
DEPENDS libraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
|
||||
if (HDF5_BUILD_FORTRAN)
|
||||
CPACK_ADD_COMPONENT (fortlibraries
|
||||
DISPLAY_NAME "HDF5 Fortran Libraries"
|
||||
DEPENDS libraries
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (fortheaders
|
||||
DISPLAY_NAME "HDF5 Fortran Headers"
|
||||
DEPENDS fortlibraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
endif (HDF5_BUILD_FORTRAN)
|
||||
|
||||
if (HDF5_BUILD_CPP_LIB)
|
||||
CPACK_ADD_COMPONENT (cpplibraries
|
||||
DISPLAY_NAME "HDF5 C++ Libraries"
|
||||
DEPENDS libraries
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (cppheaders
|
||||
DISPLAY_NAME "HDF5 C++ Headers"
|
||||
DEPENDS cpplibraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
endif (HDF5_BUILD_CPP_LIB)
|
||||
|
||||
if (HDF5_BUILD_TOOLS)
|
||||
CPACK_ADD_COMPONENT (toolsapplications
|
||||
DISPLAY_NAME "HDF5 Tools Applications"
|
||||
DEPENDS toolslibraries
|
||||
GROUP Applications
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (toolslibraries
|
||||
DISPLAY_NAME "HDF5 Tools Libraries"
|
||||
DEPENDS libraries
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (toolsheaders
|
||||
DISPLAY_NAME "HDF5 Tools Headers"
|
||||
DEPENDS toolslibraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
endif (HDF5_BUILD_TOOLS)
|
||||
|
||||
if (HDF5_BUILD_HL_LIB)
|
||||
CPACK_ADD_COMPONENT (hllibraries
|
||||
DISPLAY_NAME "HDF5 HL Libraries"
|
||||
DEPENDS libraries
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (hlheaders
|
||||
DISPLAY_NAME "HDF5 HL Headers"
|
||||
DEPENDS hllibraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
CPACK_ADD_COMPONENT (hltoolsapplications
|
||||
DISPLAY_NAME "HDF5 HL Tools Applications"
|
||||
DEPENDS hllibraries
|
||||
GROUP Applications
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
if (HDF5_BUILD_CPP_LIB)
|
||||
CPACK_ADD_COMPONENT (hlcpplibraries
|
||||
DISPLAY_NAME "HDF5 HL C++ Libraries"
|
||||
DEPENDS hllibraries
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
CPACK_ADD_COMPONENT (hlcppheaders
|
||||
DISPLAY_NAME "HDF5 HL C++ Headers"
|
||||
DEPENDS hlcpplibraries
|
||||
GROUP Development
|
||||
INSTALL_TYPES Full Developer
|
||||
)
|
||||
endif (HDF5_BUILD_CPP_LIB)
|
||||
if (HDF5_BUILD_FORTRAN)
|
||||
CPACK_ADD_COMPONENT (hlfortlibraries
|
||||
DISPLAY_NAME "HDF5 HL Fortran Libraries"
|
||||
DEPENDS fortlibraries
|
||||
GROUP Runtime
|
||||
INSTALL_TYPES Full Developer User
|
||||
)
|
||||
endif (HDF5_BUILD_FORTRAN)
|
||||
endif (HDF5_BUILD_HL_LIB)
|
||||
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES)
|
||||
700
CMakeLists.txt
Normal file
700
CMakeLists.txt
Normal file
@@ -0,0 +1,700 @@
|
||||
cmake_minimum_required (VERSION 3.1.0)
|
||||
PROJECT (HDF5 C CXX)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Instructions for use : Normal Build
|
||||
#
|
||||
# For standard build of HDF5 libraries,tests and tools.
|
||||
# Run cmake using the HDF5 source tree to generate a build tree.
|
||||
# Enable/Disable options according to requirements and
|
||||
# set CMAKE_INSTALL_PREFIX to the required install path.
|
||||
# Make install can be used to install all components for system-wide use.
|
||||
#
|
||||
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
|
||||
"CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
" == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n"
|
||||
"NEXT STEPS:\n"
|
||||
"(1) Delete the CMakeCache.txt file and the CMakeFiles/ directory\n"
|
||||
" under the source directory for ${PROJECT_NAME}, otherwise you\n"
|
||||
" will not be able to configure ${PROJECT_NAME} correctly!\n"
|
||||
" * For example, on linux machines do:\n"
|
||||
" $ rm -r CMakeCache.txt CMakeFiles/\n"
|
||||
"(2) Create a different directory and configure ${PROJECT_NAME} in that directory.\n"
|
||||
" * For example, on linux machines do:\n"
|
||||
" $ mkdir MY_BUILD\n"
|
||||
" $ cd MY_BUILD\n"
|
||||
" $ cmake [OPTIONS] ..\n"
|
||||
)
|
||||
endif ()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Instructions for use : Sub-Project Build
|
||||
#
|
||||
# To include HDF5 as a sub-project within another project.
|
||||
# Set HDF5_EXTERNALLY_CONFIGURED to 1 in the parent project and
|
||||
# supply values for the following variables...
|
||||
#
|
||||
# HDF5_EXPORTED_TARGETS :
|
||||
# Set this to the name of the targets variable which controls exports
|
||||
# If unset (because parent project does not support/use the
|
||||
# install (EXPORT target...) syntax), then targets are not configured
|
||||
# for export during install.
|
||||
#
|
||||
# HDF5_LIB_DEPENDENCIES :
|
||||
# If the build of HDF5 libs is being customized, then rules for the
|
||||
# dependencies of the HDF5 libs may be 'incomplete', add additional
|
||||
# dependencies to this variable so that external projects pick them up
|
||||
#
|
||||
# HDF5_EXTERNAL_LIB_PREFIX :
|
||||
# If the parent project needs to install hdf libraries, but avoid
|
||||
# name conflicts with system versions, then a prefix may be added
|
||||
# to ensure that the correct versions configured are used.
|
||||
#
|
||||
# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR, HDF5_INSTALL_DATA_DIR :
|
||||
# Customize the 'bin', 'lib', 'include', and 'share' installation directories.
|
||||
#
|
||||
# HDF5_INSTALL_NO_DEVELOPMENT :
|
||||
# Set to true to skip installation of headers and CMake package files.
|
||||
#
|
||||
# Consider this example from the ParaView project, it builds its own zlib
|
||||
# library and tells HDF5 to add it as a dependency - this ensures that
|
||||
# any project making use of this build of HDF5 will use the correct zlib
|
||||
#
|
||||
# # Tell hdf5 that we are manually overriding certain settings
|
||||
# set (HDF5_EXTERNALLY_CONFIGURED 1)
|
||||
# # Avoid duplicating names of installed libraries
|
||||
# set (HDF5_EXTERNAL_LIB_PREFIX "vtk")
|
||||
# # Export configuration to this export variable
|
||||
# set (HDF5_EXPORTED_TARGETS "paraview-targets")
|
||||
#
|
||||
# # Setup all necessary overrides for zlib so that HDF5 uses our
|
||||
# # internally compiled zlib rather than any other version
|
||||
# if (HDF5_ENABLE_Z_LIB_SUPPORT)
|
||||
# # We must tell the main HDF5 library that it depends on our zlib
|
||||
# set (HDF5_LIB_DEPENDENCIES vtkzlib)
|
||||
# # Override the zlib header file
|
||||
# if (VTK_USE_SYSTEM_ZLIB)
|
||||
# set (H5_ZLIB_HEADER "zlib.h")
|
||||
# else (VTK_USE_SYSTEM_ZLIB)
|
||||
# set (H5_ZLIB_HEADER "vtk_zlib.h")
|
||||
# # Set vars that FindZlib would have set if used in sub project
|
||||
# set (ZLIB_INCLUDE_DIRS "${VTK_ZLIB_INCLUDE_DIRS}")
|
||||
# set (ZLIB_LIBRARIES vtkzlib)
|
||||
# endif (VTK_USE_SYSTEM_ZLIB)
|
||||
# endif (HDF5_ENABLE_Z_LIB_SUPPORT)
|
||||
#
|
||||
# # Add the sub project
|
||||
# add_subdirectory (Utilities/hdf5-1.8)
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Allow Visual Studio solution directories
|
||||
#-----------------------------------------------------------------------------
|
||||
# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
|
||||
# organization feature. Default to ON for non-Express users. Express users must
|
||||
# explicitly turn off this option to build HDF5 in the Express IDE...
|
||||
#
|
||||
option (HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
|
||||
mark_as_advanced (HDF5_USE_FOLDERS)
|
||||
if (HDF5_USE_FOLDERS)
|
||||
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
endif (HDF5_USE_FOLDERS)
|
||||
option (HDF5_NO_PACKAGES "CPACK - Disable packaging" OFF)
|
||||
mark_as_advanced (HDF5_NO_PACKAGES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set the core names of all the libraries
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF5_LIB_CORENAME "hdf5")
|
||||
set (HDF5_TEST_LIB_CORENAME "hdf5_test")
|
||||
set (HDF5_CPP_LIB_CORENAME "hdf5_cpp")
|
||||
set (HDF5_HL_LIB_CORENAME "hdf5_hl")
|
||||
set (HDF5_HL_CPP_LIB_CORENAME "hdf5_hl_cpp")
|
||||
set (HDF5_TOOLS_LIB_CORENAME "hdf5_tools")
|
||||
set (HDF5_F90_LIB_CORENAME "hdf5_fortran")
|
||||
set (HDF5_F90_C_LIB_CORENAME "hdf5_f90cstub")
|
||||
set (HDF5_F90_TEST_LIB_CORENAME "hdf5_test_fortran")
|
||||
set (HDF5_F90_C_TEST_LIB_CORENAME "hdf5_test_f90cstub")
|
||||
set (HDF5_HL_F90_LIB_CORENAME "hdf5_hl_fortran")
|
||||
set (HDF5_HL_F90_C_LIB_CORENAME "hdf5_hl_f90cstub")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set the true names of all the libraries if customized by external project
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_CORENAME}")
|
||||
set (HDF5_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_LIB_CORENAME}")
|
||||
set (HDF5_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_CPP_LIB_CORENAME}")
|
||||
set (HDF5_HL_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_LIB_CORENAME}")
|
||||
set (HDF5_HL_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_CPP_LIB_CORENAME}")
|
||||
set (HDF5_TOOLS_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOLS_LIB_CORENAME}")
|
||||
set (HDF5_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_LIB_CORENAME}")
|
||||
set (HDF5_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_C_LIB_CORENAME}")
|
||||
set (HDF5_F90_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_TEST_LIB_CORENAME}")
|
||||
set (HDF5_F90_C_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_C_TEST_LIB_CORENAME}")
|
||||
set (HDF5_HL_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_LIB_CORENAME}")
|
||||
set (HDF5_HL_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_C_LIB_CORENAME}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set the target names of all the libraries
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF5_LIB_TARGET ${HDF5_LIB_CORENAME})
|
||||
set (HDF5_TEST_LIB_TARGET ${HDF5_TEST_LIB_CORENAME})
|
||||
set (HDF5_CPP_LIB_TARGET ${HDF5_CPP_LIB_CORENAME})
|
||||
set (HDF5_HL_LIB_TARGET ${HDF5_HL_LIB_CORENAME})
|
||||
set (HDF5_HL_CPP_LIB_TARGET ${HDF5_HL_CPP_LIB_CORENAME})
|
||||
set (HDF5_TOOLS_LIB_TARGET ${HDF5_TOOLS_LIB_CORENAME})
|
||||
set (HDF5_F90_LIB_TARGET ${HDF5_F90_LIB_CORENAME})
|
||||
set (HDF5_F90_C_LIB_TARGET ${HDF5_F90_C_LIB_CORENAME})
|
||||
set (HDF5_F90_TEST_LIB_TARGET ${HDF5_F90_TEST_LIB_CORENAME})
|
||||
set (HDF5_F90_C_TEST_LIB_TARGET ${HDF5_F90_C_TEST_LIB_CORENAME})
|
||||
set (HDF5_HL_F90_LIB_TARGET ${HDF5_HL_F90_LIB_CORENAME})
|
||||
set (HDF5_HL_F90_C_LIB_TARGET ${HDF5_HL_F90_C_LIB_CORENAME})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Define some CMake variables for use later in the project
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF_RESOURCES_DIR ${HDF5_SOURCE_DIR}/config/cmake)
|
||||
set (HDF_RESOURCES_EXT_DIR ${HDF5_SOURCE_DIR}/config/cmake_ext_mod)
|
||||
set (HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/src)
|
||||
set (HDF5_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/test)
|
||||
set (HDF5_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/c++)
|
||||
set (HDF5_CPP_TST_DIR ${HDF5_SOURCE_DIR}/c++/test)
|
||||
set (HDF5_HL_SRC_DIR ${HDF5_SOURCE_DIR}/hl)
|
||||
set (HDF5_HL_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/hl/c++)
|
||||
set (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools)
|
||||
set (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/tools/perform)
|
||||
set (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran)
|
||||
|
||||
if (NOT HDF5_INSTALL_BIN_DIR)
|
||||
set (HDF5_INSTALL_BIN_DIR bin)
|
||||
endif (NOT HDF5_INSTALL_BIN_DIR)
|
||||
if (NOT HDF5_INSTALL_LIB_DIR)
|
||||
set (HDF5_INSTALL_LIB_DIR lib)
|
||||
endif (NOT HDF5_INSTALL_LIB_DIR)
|
||||
if (NOT HDF5_INSTALL_INCLUDE_DIR)
|
||||
set (HDF5_INSTALL_INCLUDE_DIR include)
|
||||
endif (NOT HDF5_INSTALL_INCLUDE_DIR)
|
||||
if (NOT HDF5_INSTALL_DATA_DIR)
|
||||
if (NOT WIN32)
|
||||
set (HDF5_INSTALL_DATA_DIR share)
|
||||
set (HDF5_INSTALL_CMAKE_DIR share/cmake)
|
||||
else (NOT WIN32)
|
||||
set (HDF5_INSTALL_DATA_DIR ".")
|
||||
set (HDF5_INSTALL_CMAKE_DIR cmake)
|
||||
endif (NOT WIN32)
|
||||
endif (NOT HDF5_INSTALL_DATA_DIR)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# parse the full version number from H5public.h and include in H5_VERS_INFO
|
||||
#-----------------------------------------------------------------------------
|
||||
file (READ ${HDF5_SRC_DIR}/H5public.h _h5public_h_contents)
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MAJOR[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_MAJOR ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_MINOR ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_VERS_RELEASE ${_h5public_h_contents})
|
||||
string (REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\"([0-9A-Za-z._]*)\".*$"
|
||||
"\\1" H5_VERS_SUBRELEASE ${_h5public_h_contents})
|
||||
#message (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# parse the full soversion number from config/lt_vers.am and include in H5_SOVERS_INFO
|
||||
#-----------------------------------------------------------------------------
|
||||
file (READ ${HDF5_SOURCE_DIR}/config/lt_vers.am _lt_vers_am_contents)
|
||||
string (REGEX REPLACE ".*LT_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_SOVERS_INTERFACE ${_lt_vers_am_contents})
|
||||
string (REGEX REPLACE ".*LT_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_SOVERS_MINOR ${_lt_vers_am_contents})
|
||||
string (REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
|
||||
"\\1" H5_SOVERS_RELEASE ${_lt_vers_am_contents})
|
||||
MATH (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE})
|
||||
message (STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Basic HDF5 stuff here
|
||||
#-----------------------------------------------------------------------------
|
||||
set (HDF5_PACKAGE "hdf5")
|
||||
set (HDF5_PACKAGE_NAME "HDF5")
|
||||
set (HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}")
|
||||
set (HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}")
|
||||
set (HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}")
|
||||
if (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "")
|
||||
set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}")
|
||||
else (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "")
|
||||
set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}")
|
||||
endif (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "")
|
||||
set (HDF5_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}")
|
||||
set (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}")
|
||||
set (HDF5_PACKAGE_TARNAME "${HDF5_PACKAGE}${HDF_PACKAGE_EXT}")
|
||||
set (HDF5_PACKAGE_URL "http://www.hdfgroup.org")
|
||||
set (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Include some macros for reusable code
|
||||
#-----------------------------------------------------------------------------
|
||||
include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake)
|
||||
include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake)
|
||||
include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup output Directories
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables."
|
||||
)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries"
|
||||
)
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries."
|
||||
)
|
||||
set (CMAKE_Fortran_MODULE_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules."
|
||||
)
|
||||
else (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
# if we are externally configured, but the project uses old cmake scripts
|
||||
# this may not be set and utilities like H5detect will fail
|
||||
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
||||
endif (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Targets built within this project are exported at Install time for use
|
||||
# by other projects using FindHDF5.
|
||||
#-----------------------------------------------------------------------------
|
||||
if (NOT HDF5_EXPORTED_TARGETS)
|
||||
set (HDF5_EXPORTED_TARGETS "hdf5-targets")
|
||||
endif (NOT HDF5_EXPORTED_TARGETS)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# To include a library in the list exported by the project AT BUILD TIME,
|
||||
# add it to this variable. This is NOT used by Make Install, but for projects
|
||||
# which include hdf5 as a sub-project within their build tree
|
||||
#-----------------------------------------------------------------------------
|
||||
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "")
|
||||
set (EXTERNAL_HEADER_LIST "")
|
||||
set (EXTERNAL_LIBRARY_LIST "")
|
||||
set (EXTERNAL_LIBRARYDLL_LIST "")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Run all the CMake configuration tests for our build environment
|
||||
#-----------------------------------------------------------------------------
|
||||
include (${HDF_RESOURCES_DIR}/ConfigureChecks.cmake)
|
||||
|
||||
set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to Build Shared/Static libs, default is static
|
||||
#-----------------------------------------------------------------------------
|
||||
option (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
||||
set (LIB_TYPE STATIC)
|
||||
set (H5_ENABLE_SHARED_LIB NO)
|
||||
set (H5_ENABLE_STATIC_LIB NO)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (LIB_TYPE SHARED)
|
||||
set (H5_BUILT_AS_DYNAMIC_LIB 1)
|
||||
set (H5_ENABLE_SHARED_LIB YES)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
set (H5_BUILT_AS_STATIC_LIB 1)
|
||||
set (H5_ENABLE_STATIC_LIB YES)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to Build Static executables
|
||||
#-----------------------------------------------------------------------------
|
||||
option (BUILD_STATIC_EXECS "Build Static Executabless" OFF)
|
||||
if (BUILD_STATIC_EXECS)
|
||||
if (NOT WIN32)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||
endif (NOT WIN32)
|
||||
endif (BUILD_STATIC_EXECS)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to use code coverage
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF)
|
||||
if (HDF5_ENABLE_COVERAGE)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
|
||||
set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")
|
||||
endif (HDF5_ENABLE_COVERAGE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to indicate using dmalloc
|
||||
#-----------------------------------------------------------------------------
|
||||
# option (HDF5_ENABLE_USING_DMALLOC "Indicate that dmalloc is used" OFF)
|
||||
# if (HDF5_ENABLE_USING_DMALLOC)
|
||||
# find_package (DMALLOC)
|
||||
# set (H5_HAVE_DMALLOC DMALLOC_FOUND)
|
||||
# endif (HDF5_ENABLE_USING_DMALLOC)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to indicate using a memory checker
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF)
|
||||
if (HDF5_ENABLE_USING_MEMCHECKER)
|
||||
set (H5_USING_MEMCHECKER 1)
|
||||
endif (HDF5_ENABLE_USING_MEMCHECKER)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to use deprecated public API symbols
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON)
|
||||
if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
|
||||
set (H5_NO_DEPRECATED_SYMBOLS 0)
|
||||
else (HDF5_ENABLE_DEPRECATED_SYMBOLS)
|
||||
set (H5_NO_DEPRECATED_SYMBOLS 1)
|
||||
endif (HDF5_ENABLE_DEPRECATED_SYMBOLS)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# When building utility executables that generate other (source) files :
|
||||
# we make use of the following variables defined in the root CMakeLists.
|
||||
# Certain systems may add /Debug or /Release to output paths
|
||||
# and we need to call the executable from inside the CMake configuration
|
||||
#-----------------------------------------------------------------------------
|
||||
set (EXE_EXT "")
|
||||
if (WIN32)
|
||||
set (EXE_EXT ".exe")
|
||||
if (NOT CYGWIN)
|
||||
add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions (-D_CONSOLE)
|
||||
endif (NOT CYGWIN)
|
||||
endif (WIN32)
|
||||
|
||||
if (MSVC)
|
||||
set (CMAKE_MFC_FLAG 0)
|
||||
set (WIN_COMPILE_FLAGS "")
|
||||
set (WIN_LINK_FLAGS "")
|
||||
endif (MSVC)
|
||||
|
||||
set (MAKE_SYSTEM)
|
||||
if (CMAKE_BUILD_TOOL MATCHES "make")
|
||||
set (MAKE_SYSTEM 1)
|
||||
endif (CMAKE_BUILD_TOOL MATCHES "make")
|
||||
|
||||
set (CFG_INIT "/${CMAKE_CFG_INTDIR}")
|
||||
if (MAKE_SYSTEM)
|
||||
set (CFG_INIT "")
|
||||
endif (MAKE_SYSTEM)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add some definitions for Debug Builds
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF)
|
||||
mark_as_advanced (HDF5_ENABLE_TRACE)
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions (-DDEBUG)
|
||||
# Enable tracing of the API
|
||||
if (HDF5_ENABLE_TRACE)
|
||||
add_definitions (-DH5_DEBUG_API )
|
||||
endif (HDF5_ENABLE_TRACE)
|
||||
# Enable instrumenting of the library's internal operations
|
||||
option (HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF)
|
||||
if (HDF5_ENABLE_INSTRUMENT)
|
||||
set (H5_HAVE_INSTRUMENTED_LIBRARY 1)
|
||||
endif (HDF5_ENABLE_INSTRUMENT)
|
||||
mark_as_advanced (HDF5_ENABLE_INSTRUMENT)
|
||||
#-- NMake Makefiles will overwhelm the console with warnings if -Wall is used.
|
||||
if (NOT WIN32)
|
||||
add_definitions (-Wall)
|
||||
endif (NOT WIN32)
|
||||
else (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions (-DNDEBUG)
|
||||
if (HDF5_ENABLE_TRACE)
|
||||
add_definitions (-DH5_DEBUG_API )
|
||||
endif (HDF5_ENABLE_TRACE)
|
||||
endif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to embed library info into executables
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON)
|
||||
if (HDF5_ENABLE_EMBEDDED_LIBINFO)
|
||||
set (H5_HAVE_EMBEDDED_LIBINFO 1)
|
||||
endif (HDF5_ENABLE_EMBEDDED_LIBINFO)
|
||||
|
||||
include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# All libs/tests/examples need the main include directories
|
||||
#-----------------------------------------------------------------------------
|
||||
INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR} ${HDF5_SRC_DIR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to Enable MPI Parallel
|
||||
#-----------------------------------------------------------------------------
|
||||
set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH})
|
||||
option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF)
|
||||
if (HDF5_ENABLE_PARALLEL)
|
||||
include (FindMPI)
|
||||
INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_PATH})
|
||||
if (MPI_C_FOUND)
|
||||
set (H5_HAVE_PARALLEL 1)
|
||||
# MPI checks, only do these if MPI_C_FOUND is true, otherwise they always fail
|
||||
# and once set, they are cached as false and not regenerated
|
||||
set (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" )
|
||||
# Used by Fortran + MPI
|
||||
CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm)
|
||||
CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info)
|
||||
else (MPI_C_FOUND)
|
||||
message (STATUS "Parallel libraries not found")
|
||||
endif (MPI_C_FOUND)
|
||||
endif (HDF5_ENABLE_PARALLEL)
|
||||
|
||||
# Parallel IO usage requires MPI to be Linked and Included
|
||||
if (H5_HAVE_PARALLEL)
|
||||
set (LINK_LIBS ${LINK_LIBS} ${MPI_C_LIBRARIES})
|
||||
if (MPI_C_LINK_FLAGS)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif (MPI_C_LINK_FLAGS)
|
||||
endif (H5_HAVE_PARALLEL)
|
||||
|
||||
set (DEFAULT_API_VERSION "v110")
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to use 1.6.x API
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF)
|
||||
set (H5_USE_16_API_DEFAULT 0)
|
||||
if (HDF5_USE_16_API_DEFAULT)
|
||||
set (H5_USE_16_API_DEFAULT 1)
|
||||
set (DEFAULT_API_VERSION "v16")
|
||||
endif (HDF5_USE_16_API_DEFAULT)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to use 1.8.x API
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF)
|
||||
set (H5_USE_18_API_DEFAULT 0)
|
||||
if (HDF5_USE_18_API_DEFAULT)
|
||||
set (H5_USE_18_API_DEFAULT 1)
|
||||
set (DEFAULT_API_VERSION "v18")
|
||||
endif (HDF5_USE_18_API_DEFAULT)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Include user macros
|
||||
#-----------------------------------------------------------------------------
|
||||
include (UserMacros.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Include filter (zlib, szip, etc.) macros
|
||||
#-----------------------------------------------------------------------------
|
||||
include (CMakeFilters.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option for external libraries on windows
|
||||
#-----------------------------------------------------------------------------
|
||||
option (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF)
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
if (HDF5_PACKAGE_EXTLIBS)
|
||||
set (HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
|
||||
if (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
|
||||
PACKAGE_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
|
||||
endif (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
|
||||
|
||||
if (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
|
||||
PACKAGE_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT})
|
||||
endif (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
|
||||
endif (HDF5_PACKAGE_EXTLIBS)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to use threadsafe
|
||||
# Note: Currently CMake only allows configuring of threadsafe on
|
||||
# non-Cygwin WINDOWS.
|
||||
#-----------------------------------------------------------------------------
|
||||
if (WIN32)
|
||||
option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF)
|
||||
if (HDF5_ENABLE_THREADSAFE)
|
||||
# check for unsupported options
|
||||
if (H5_BUILT_AS_STATIC_LIB)
|
||||
message (FATAL_ERROR " **** thread-safety option not supported with static library **** ")
|
||||
endif (H5_BUILT_AS_STATIC_LIB)
|
||||
if (HDF5_ENABLE_PARALLEL)
|
||||
message (FATAL_ERROR " **** parallel and thread-safety options are not supported **** ")
|
||||
endif (HDF5_ENABLE_PARALLEL)
|
||||
if (HDF5_BUILD_FORTRAN)
|
||||
message (FATAL_ERROR " **** Fortran and thread-safety options are not supported **** ")
|
||||
endif (HDF5_BUILD_FORTRAN)
|
||||
if (HDF5_BUILD_CPP_LIB)
|
||||
message (FATAL_ERROR " **** C++ and thread-safety options are not supported **** ")
|
||||
endif (HDF5_BUILD_CPP_LIB)
|
||||
set (H5_HAVE_THREADSAFE 1)
|
||||
if (H5_HAVE_IOEO)
|
||||
message (STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ")
|
||||
set (H5_HAVE_WIN_THREADS 1)
|
||||
else (H5_HAVE_IOEO)
|
||||
if (NOT H5_HAVE_PTHREAD_H)
|
||||
set (H5_HAVE_THREADSAFE 0)
|
||||
message (FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** ")
|
||||
endif (NOT H5_HAVE_PTHREAD_H)
|
||||
endif (H5_HAVE_IOEO)
|
||||
endif (HDF5_ENABLE_THREADSAFE)
|
||||
endif (WIN32)
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# wrapper script variables
|
||||
#
|
||||
#set (CFLAGS "${C_DEFINES}")
|
||||
#set (CXXFLAGS "${CXX_DEFINES}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add the HDF5 Library Target to the build
|
||||
#-----------------------------------------------------------------------------
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
|
||||
|
||||
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
|
||||
ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB)
|
||||
endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
|
||||
if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
|
||||
ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP)
|
||||
endif (SZIP_FOUND AND SZIP_USE_EXTERNAL)
|
||||
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Dashboard and Testing Settings
|
||||
#-----------------------------------------------------------------------------
|
||||
option (BUILD_TESTING "Build HDF5 Unit Testing" ON)
|
||||
if (BUILD_TESTING)
|
||||
set (DART_TESTING_TIMEOUT 1200
|
||||
CACHE INTEGER
|
||||
"Timeout in seconds for each test (default 1200=20minutes)"
|
||||
)
|
||||
enable_testing ()
|
||||
include (CTest)
|
||||
if (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test")
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib)
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test")
|
||||
if (H5_HAVE_PARALLEL)
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar")
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/testpar ${PROJECT_BINARY_DIR}/testpar)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar")
|
||||
endif (H5_HAVE_PARALLEL)
|
||||
endif (NOT HDF5_EXTERNALLY_CONFIGURED)
|
||||
|
||||
option (HDF5_TEST_VFD "Execute tests with different VFDs" OFF)
|
||||
mark_as_advanced (HDF5_TEST_VFD)
|
||||
if (HDF5_TEST_VFD)
|
||||
option (HDF5_TEST_FHEAP_VFD "Execute tests with different VFDs" ON)
|
||||
mark_as_advanced (HDF5_TEST_FHEAP_VFD)
|
||||
endif (HDF5_TEST_VFD)
|
||||
|
||||
include (${HDF5_SOURCE_DIR}/CTestConfig.cmake)
|
||||
configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF5_BINARY_DIR}/CTestCustom.ctest @ONLY)
|
||||
endif (BUILD_TESTING)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to build HDF5 Tools
|
||||
#-----------------------------------------------------------------------------
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
|
||||
option (HDF5_BUILD_TOOLS "Build HDF5 Tools" ON)
|
||||
if (HDF5_BUILD_TOOLS)
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
|
||||
endif (HDF5_BUILD_TOOLS)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to build examples
|
||||
#-----------------------------------------------------------------------------
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
|
||||
option (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON)
|
||||
if (HDF5_BUILD_EXAMPLES)
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
|
||||
endif (HDF5_BUILD_EXAMPLES)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to build High Level API's
|
||||
#-----------------------------------------------------------------------------
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
|
||||
option (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON)
|
||||
if (HDF5_BUILD_HL_LIB)
|
||||
set (H5_INCLUDE_HL 1)
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl)
|
||||
endif (HDF5_BUILD_HL_LIB)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to build Fortran bindings/tests/examples
|
||||
# Make sure this appears before the CONFIGURE_FILE step
|
||||
# so that fortran name mangling is detected before writing H5pubconf.h
|
||||
#-----------------------------------------------------------------------------
|
||||
# Set default name mangling : overridden by Fortran detection in fortran dir
|
||||
set (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _")
|
||||
set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
|
||||
option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
|
||||
if (HDF5_BUILD_FORTRAN)
|
||||
if (BUILD_SHARED_LIBS AND APPLE)
|
||||
message (FATAL_ERROR " **** Shared FORTRAN libraries are unsupported **** ")
|
||||
endif (BUILD_SHARED_LIBS AND APPLE)
|
||||
option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON)
|
||||
include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake)
|
||||
if (HDF5_ENABLE_F2003)
|
||||
if (NOT FORTRAN_HAVE_ISO_C_BINDING)
|
||||
set (HDF5_ENABLE_F2003 OFF)
|
||||
endif (NOT FORTRAN_HAVE_ISO_C_BINDING)
|
||||
endif (HDF5_ENABLE_F2003)
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# wrapper script variables
|
||||
#
|
||||
# set (FCFLAGS "${Fortran_DEFINES}")
|
||||
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran)
|
||||
if (HDF5_BUILD_HL_LIB)
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
|
||||
#-- Build the High Level Fortran source codes
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/hl/fortran ${PROJECT_BINARY_DIR}/hl/fortran)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran")
|
||||
endif (HDF5_BUILD_HL_LIB)
|
||||
endif (HDF5_BUILD_FORTRAN)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to build HDF5 C++ Library
|
||||
#-----------------------------------------------------------------------------
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
|
||||
option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON)
|
||||
if (HDF5_BUILD_CPP_LIB)
|
||||
# check for unsupported options
|
||||
if (HDF5_ENABLE_PARALLEL)
|
||||
message (FATAL_ERROR " **** Parallel and C++ options are mutually exclusive **** ")
|
||||
endif (HDF5_ENABLE_PARALLEL)
|
||||
if (CMAKE_NO_STD_NAMESPACE)
|
||||
set (H5_NO_STD 1)
|
||||
endif (CMAKE_NO_STD_NAMESPACE)
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++)
|
||||
if (HDF5_BUILD_HL_LIB)
|
||||
if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++")
|
||||
#-- Build the High Level Fortran source codes
|
||||
add_subdirectory (${HDF5_SOURCE_DIR}/hl/c++ ${PROJECT_BINARY_DIR}/hl/c++)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++")
|
||||
endif (HDF5_BUILD_HL_LIB)
|
||||
endif (HDF5_BUILD_CPP_LIB)
|
||||
endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Check if Fortran's default real is double precision. If it is and HL is
|
||||
# being built then configure should fail due to bug HDFFV-889.
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB )
|
||||
if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
|
||||
message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ")
|
||||
endif (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
|
||||
endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB )
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generate the H5pubconf.h file containing user settings needed by compilation
|
||||
#-----------------------------------------------------------------------------
|
||||
configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY)
|
||||
|
||||
include (CMakeInstallation.cmake)
|
||||
32
COPYING
32
COPYING
@@ -4,18 +4,13 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
HDF5 (Hierarchical Data Format 5) Software Library and Utilities
|
||||
Copyright 2006-2008 by The HDF Group.
|
||||
Copyright 2006-2015 by The HDF Group.
|
||||
|
||||
NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities
|
||||
Copyright 1998-2006 by the Board of Trustees of the University of Illinois.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Contributors: National Center for Supercomputing Applications (NCSA) at
|
||||
the University of Illinois, Fortner Software, Unidata Program Center (netCDF),
|
||||
The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip),
|
||||
and Digital Equipment Corporation (DEC).
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted for any purpose (including commercial purposes)
|
||||
provided that the following conditions are met:
|
||||
@@ -39,8 +34,8 @@ provided that the following conditions are met:
|
||||
|
||||
5. Neither the name of The HDF Group, the name of the University, nor the
|
||||
name of any Contributor may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission from the
|
||||
University, The HDF Group, or the Contributor, respectively.
|
||||
from this software without specific prior written permission from
|
||||
The HDF Group, the University, or the Contributor, respectively.
|
||||
|
||||
DISCLAIMER:
|
||||
THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS
|
||||
@@ -50,6 +45,21 @@ suffered by the users arising out of the use of this software, even if
|
||||
advised of the possibility of such damage.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Contributors: National Center for Supercomputing Applications (NCSA) at
|
||||
the University of Illinois, Fortner Software, Unidata Program Center (netCDF),
|
||||
The Independent JPEG Group (JPEG), Jean-loup Gailly and Mark Adler (gzip),
|
||||
and Digital Equipment Corporation (DEC).
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Portions of HDF5 were developed with support from the Lawrence Berkeley
|
||||
National Laboratory (LBNL) and the United States Department of Energy
|
||||
under Prime Contract No. DE-AC02-05CH11231.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Portions of HDF5 were developed with support from the University of
|
||||
California, Lawrence Livermore National Laboratory (UC LLNL).
|
||||
The following statement applies to those portions of the product and must
|
||||
@@ -77,6 +87,12 @@ and/or accompanying materials:
|
||||
opinions of authors expressed herein do not necessarily state or reflect
|
||||
those of the United States Government or the University of California,
|
||||
and shall not be used for advertising or product endorsement purposes.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
HDF5 is available with the SZIP compression library but SZIP is not part
|
||||
of HDF5 and has separate copyright and license terms. See “Szip Compression
|
||||
in HDF Products” (www.hdfgroup.org/doc_resource/SZIP/) for further details.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
32
CTestConfig.cmake
Normal file
32
CTestConfig.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
## This file should be placed in the root directory of your project.
|
||||
## Then modify the CMakeLists.txt file in the root directory of your
|
||||
## project to incorporate the testing dashboard.
|
||||
## # The following are required to uses Dart and the Cdash dashboard
|
||||
## ENABLE_TESTING()
|
||||
## INCLUDE(CTest)
|
||||
set (CTEST_PROJECT_NAME "HDF5")
|
||||
set (CTEST_NIGHTLY_START_TIME "18:00:00 CST")
|
||||
|
||||
set (CTEST_DROP_METHOD "http")
|
||||
if (CDASH_LOCAL)
|
||||
set (CTEST_DROP_SITE "72.36.68.252")
|
||||
set (CTEST_DROP_LOCATION "/submit.php?project=HDF5Trunk")
|
||||
else (CDASH_LOCAL)
|
||||
set (CTEST_DROP_SITE "cdash.hdfgroup.uiuc.edu")
|
||||
set (CTEST_DROP_LOCATION "/submit.php?project=HDF5+Trunk")
|
||||
endif (CDASH_LOCAL)
|
||||
set (CTEST_DROP_SITE_CDASH TRUE)
|
||||
|
||||
set (UPDATE_TYPE svn)
|
||||
set (VALGRIND_COMMAND "/usr/bin/valgrind")
|
||||
set (VALGRIND_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe")
|
||||
set (CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
|
||||
set (CTEST_MEMORYCHECK_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe")
|
||||
|
||||
set (CTEST_TEST_TIMEOUT 1200 CACHE STRING
|
||||
"Maximum time allowed before CTest will kill the test.")
|
||||
set (DART_TESTING_TIMEOUT 1200 CACHE STRING
|
||||
"Maximum time allowed before CTest will kill the test." FORCE)
|
||||
|
||||
SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING
|
||||
"How long to wait between timed-out CTest submissions.")
|
||||
59
Makefile.am
Executable file → Normal file
59
Makefile.am
Executable file → Normal file
@@ -73,46 +73,42 @@ else
|
||||
endif
|
||||
|
||||
SUBDIRS = src test $(TESTPARALLEL_DIR) tools . $(CXX_DIR) $(FORTRAN_DIR) \
|
||||
$(HDF5_HL_DIR) perform
|
||||
DIST_SUBDIRS = src test testpar tools . c++ fortran hl perform examples
|
||||
$(HDF5_HL_DIR)
|
||||
DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples
|
||||
|
||||
# Some files generated during configure that should be cleaned
|
||||
DISTCLEANFILES=config/stamp1 config/stamp2
|
||||
|
||||
# Some files/directories generated during check that should be cleaned
|
||||
CHECK_CLEANFILES+=*-tmp
|
||||
|
||||
# Define rules for lib, progs, check, and tests.
|
||||
# These simply involve recursing into subdirectories.
|
||||
test _test: check
|
||||
|
||||
lib progs check-p check-s:
|
||||
@@SETX@; for d in $(SUBDIRS); do \
|
||||
for d in $(SUBDIRS); do \
|
||||
if test $$d != .; then \
|
||||
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# Make all, tests, and (un)install also recurse into perform directory
|
||||
all-local:
|
||||
@cd perform && $(MAKE) $(AM_MAKEFLAGS) all
|
||||
|
||||
# Make all, tests, and (un)install
|
||||
tests:
|
||||
@@SETX@; for d in $(SUBDIRS) perform; do \
|
||||
for d in $(SUBDIRS); do \
|
||||
if test $$d != .; then \
|
||||
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
install-exec-local:
|
||||
@cd perform && $(MAKE) $(AM_MAKEFLAGS) install
|
||||
uninstall-local:
|
||||
@cd perform && $(MAKE) $(AM_MAKEFLAGS) uninstall
|
||||
done
|
||||
|
||||
# Check-clean also recurses into examples directory
|
||||
check-clean:
|
||||
@@SETX@; for d in $(SUBDIRS) examples perform; do \
|
||||
for d in $(SUBDIRS) examples; do \
|
||||
if test $$d != .; then \
|
||||
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(RM) -rf prefix-tmp destdir-tmp
|
||||
|
||||
# Some C++ compilers/linkers will create a directory named ii_files in
|
||||
# the root directory, which should be cleaned.
|
||||
@@ -121,17 +117,20 @@ mostlyclean-local:
|
||||
$(RM) -rf ii_files; \
|
||||
fi
|
||||
|
||||
# 'make install' will now install examples, the same as 'make install-all'.
|
||||
# 'make-install-all' will be redundant but will still work.
|
||||
install: install-recursive install-examples
|
||||
uninstall: uninstall-recursive uninstall-examples
|
||||
|
||||
# 'make install-all' also installs examples
|
||||
install-all:
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-examples
|
||||
uninstall-all:
|
||||
@$(MAKE) $(AM_MAKEFLAGS) uninstall
|
||||
@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
|
||||
|
||||
# Install examples in this directory and recursively
|
||||
install-examples uninstall-examples:
|
||||
@@SETX@; for d in examples $(HDF5_INTERFACES); do \
|
||||
for d in examples $(HDF5_INTERFACES) $(HL); do \
|
||||
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
|
||||
done
|
||||
|
||||
@@ -145,11 +144,31 @@ uninstall-doc:
|
||||
# `make check-install' or `make installcheck' checks that examples can
|
||||
# be successfully built
|
||||
installcheck-local:
|
||||
if test -n "${DESTDIR}"; then \
|
||||
(cd ${DESTDIR}$(bindir) && pwd && ./h5redeploy -force); \
|
||||
fi
|
||||
@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
|
||||
|
||||
# check-install is just a synonym for installcheck
|
||||
check-install: installcheck
|
||||
|
||||
# check-all-install tests all installation methods.
|
||||
# Install via different mechanism and then compare against the default.
|
||||
# Fine if only libXXX.a files are different since they may have been ranlib'ed.
|
||||
check-all-install:
|
||||
@echo Installing to default location
|
||||
$(MAKE) install
|
||||
@echo Installing to different prefix location
|
||||
$(MAKE) prefix=${ROOT}/prefix-tmp install
|
||||
@echo Compare against the default installation.
|
||||
@echo Fine if only libXXX.a files are different.
|
||||
-diff -r prefix-tmp ${prefix}
|
||||
@echo Installing to different $$\DESTDIR location
|
||||
env DESTDIR=${ROOT}/destdir-tmp $(MAKE) install
|
||||
@echo Compare against the default installation.
|
||||
@echo Fine if only libXXX.a files are different.
|
||||
-diff -r destdir-tmp${prefix} ${prefix}
|
||||
|
||||
# Only source files in the src directory include tracing information,
|
||||
# so 'make trace' only needs to recurse into that directory.
|
||||
trace:
|
||||
@@ -158,7 +177,7 @@ trace:
|
||||
# Run tests with different Virtual File Drivers.
|
||||
# Currently, only invoke check-vfd in the test directory.
|
||||
check-vfd:
|
||||
@@SETX@; for d in src test; do \
|
||||
for d in src test; do \
|
||||
if test $$d != .; then \
|
||||
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
|
||||
fi; \
|
||||
@@ -174,4 +193,4 @@ check-vfd:
|
||||
$(top_builddir)/config.status:
|
||||
|
||||
# Don't include conclude.am in root Makefile; tests target needs to
|
||||
# recurse into perform directory as well as reguar subdirs.
|
||||
# recurse into reguar subdirs.
|
||||
|
||||
681
Makefile.in
681
Makefile.in
File diff suppressed because it is too large
Load Diff
46
README.txt
46
README.txt
@@ -1,39 +1,37 @@
|
||||
HDF5 version 1.9.26 currently under development
|
||||
HDF5 version 1.9.222-swmr0 released on 2015-07-15
|
||||
Please refer to the release_docs/INSTALL file for installation instructions.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
This release is almost fully functional for the entire API defined in the
|
||||
documentation, see the RELEASE.txt file in the release_docs directory for information
|
||||
specific to this release of the library. The INSTALL file contains
|
||||
instructions on compiling and installing the library. The INSTALL_parallel
|
||||
file contains instructions on installing the parallel version of the
|
||||
library. The INSTALL* files can be found in the release_docs/ directory.
|
||||
This release is fully functional for the API described in the documentation.
|
||||
See the RELEASE.txt file in the release_docs/ directory for information
|
||||
specific to this release of the library. Several INSTALL* files can also be
|
||||
found in the release_docs/ directory: INSTALL contains instructions for
|
||||
compiling and installing the library; INSTALL_parallel contains instructions
|
||||
for installing the parallel version of the library; similarly-named files
|
||||
contain instructions for VMS and several environments on MS Windows systems.
|
||||
|
||||
Documentation for this snapshot can be found at the following URL:
|
||||
http://www.hdfgroup.uiuc.edu/HDF5/doc_dev_snapshot/H5_dev/
|
||||
Documentation for this release can be found at the following URL:
|
||||
http://www.hdfgroup.org/HDF5/doc/.
|
||||
|
||||
Four mailing lists are currently set up for use with the HDF5
|
||||
library.
|
||||
The following mailing lists are currently set up for HDF5 Library users:
|
||||
|
||||
news - For announcements of HDF5 related developments,
|
||||
not a discussion list.
|
||||
news - For announcements of HDF5 related developments,
|
||||
not a discussion list.
|
||||
|
||||
hdf-forum - For general discussion of the HDF5 library with
|
||||
other users.
|
||||
hdf-forum - For general discussion of the HDF5 library with
|
||||
other users.
|
||||
|
||||
hdf5dev - For discussion of the HDF5 library development
|
||||
with developers and other interested parties.
|
||||
To subscribe to a list, send mail to "<list>-subscribe@lists.hdfgroup.org".
|
||||
where <list> is the name of the list. For example, send a request
|
||||
to subscribe to the 'news' mail list to the following address:
|
||||
news-subscribe@lists.hdfgroup.org
|
||||
|
||||
To subscribe to a list, send mail to "<list>-subscribe@hdfgroup.org".
|
||||
where <list> is the name of the list.
|
||||
E.g., mail hdf5-subscribe@hdfgroup.org
|
||||
|
||||
Messages to be sent to the list should be sent to "<list>@hdfgroup.org".
|
||||
Messages sent to the list should be addressed to "<list>@lists.hdfgroup.org".
|
||||
|
||||
Periodic code snapshots are provided at the following URL:
|
||||
ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/snapshots
|
||||
Please read the README.txt file in that directory before working with a library
|
||||
snapshot.
|
||||
Please read the README.txt file in that directory before working with a
|
||||
library snapshot.
|
||||
|
||||
The HDF5 website is located at http://hdfgroup.org/HDF5/
|
||||
|
||||
|
||||
22
UserMacros.cmake
Normal file
22
UserMacros.cmake
Normal file
@@ -0,0 +1,22 @@
|
||||
########################################################
|
||||
# Include file for user options
|
||||
########################################################
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#------------------- E X A M P L E B E G I N--------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
# Option to Build with User Defined Values
|
||||
#-----------------------------------------------------------------------------
|
||||
MACRO (MACRO_USER_DEFINED_LIBS)
|
||||
set (USER_DEFINED_VALUE "FALSE")
|
||||
ENDMACRO (MACRO_USER_DEFINED_LIBS)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
option (BUILD_USER_DEFINED_LIBS "Build With User Defined Values" OFF)
|
||||
if (BUILD_USER_DEFINED_LIBS)
|
||||
MACRO_USER_DEFINED_LIBS ()
|
||||
endif (BUILD_USER_DEFINED_LIBS)
|
||||
#-----------------------------------------------------------------------------
|
||||
#------------------- E X A M P L E E N D -----------------------------------
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
3239
aclocal.m4
vendored
3239
aclocal.m4
vendored
File diff suppressed because it is too large
Load Diff
35
acsite.m4
35
acsite.m4
@@ -18,6 +18,41 @@ dnl
|
||||
dnl -------------------------------------------------------------------------
|
||||
dnl -------------------------------------------------------------------------
|
||||
|
||||
dnl -------------------------------------------------------------------------
|
||||
dnl _AC_SYS_LARGEFILE_MACRO_VALUE
|
||||
dnl
|
||||
dnl The following macro overrides the autoconf macro of the same name
|
||||
dnl with this custom definition. This macro performs the same checks as
|
||||
dnl autoconf's native _AC_SYS_LARGEFILE_MACRO_VALUE, but will also set
|
||||
dnl AM_CPPFLAGS with the appropriate -D defines so additional configure
|
||||
dnl sizeof checks do not fail.
|
||||
dnl
|
||||
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
|
||||
# CACHE-VAR,
|
||||
# DESCRIPTION,
|
||||
# PROLOGUE, [FUNCTION-BODY])
|
||||
# ----------------------------------------------------------
|
||||
m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
|
||||
[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
|
||||
[while :; do
|
||||
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
|
||||
[AC_LANG_PROGRAM([$5], [$6])],
|
||||
[$3=no; break])
|
||||
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
|
||||
[AC_LANG_PROGRAM([@%:@define $1 $2
|
||||
$5], [$6])],
|
||||
[$3=$2; break])
|
||||
$3=unknown
|
||||
break
|
||||
done])
|
||||
case $$3 in #(
|
||||
no | unknown) ;;
|
||||
*) AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
|
||||
AM_CPPFLAGS="-D$1=$$3 $AM_CPPFLAGS";;
|
||||
esac
|
||||
rm -rf conftest*[]dnl
|
||||
])# _AC_SYS_LARGEFILE_MACRO_VALUE
|
||||
|
||||
dnl -------------------------------------------------------------------------
|
||||
dnl AC_F9X_MODS()
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
Copyright by The HDF Group (THG) and
|
||||
Copyright by The HDF Group and
|
||||
The Board of Trustees of the University of Illinois.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
2
bin/README
Normal file
2
bin/README
Normal file
@@ -0,0 +1,2 @@
|
||||
The daily tests run copies of some of the scripts in this directory from another repository, notably snapshot and runtest. The copies in this directory should work, but are not used in daily tests, though they should be tested occasionally.
|
||||
|
||||
@@ -67,6 +67,7 @@ TIMESTAMP()
|
||||
|
||||
QUIT()
|
||||
{
|
||||
# print the closing time
|
||||
TIMESTAMP
|
||||
}
|
||||
|
||||
@@ -158,19 +159,6 @@ LOCATE_SZLIB()
|
||||
HP-UX)
|
||||
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/HPUX-11.00"
|
||||
;;
|
||||
IRIX)
|
||||
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/IRIX64-6.5-32bit"
|
||||
;;
|
||||
IRIX64)
|
||||
case "$CC" in
|
||||
*-n32)
|
||||
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/IRIX64-6.5-32bit"
|
||||
;;
|
||||
*)
|
||||
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/IRIX64-6.5"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Linux)
|
||||
case `uname -m` in
|
||||
i686)
|
||||
@@ -234,7 +222,7 @@ trap QUIT 0
|
||||
#
|
||||
MAKE=${MAKE:-'gmake'}
|
||||
export MAKE
|
||||
CONFIGURE="CONFIG"
|
||||
CONFIG_CMD="CONFIG"
|
||||
CONFIG_OP= # configure options
|
||||
CONFIG_ONLY=no # default is configure and build
|
||||
NOEXEC= # default to execute commands
|
||||
@@ -250,6 +238,7 @@ while [ $# -gt 0 ]; do
|
||||
;;
|
||||
-szlib)
|
||||
LOCATE_SZLIB
|
||||
CONFIG_OP="$CONFIG_OP $WITH_SZLIB"
|
||||
;;
|
||||
-help)
|
||||
USAGE
|
||||
@@ -263,16 +252,16 @@ while [ $# -gt 0 ]; do
|
||||
SRCDIRLIST="$1"
|
||||
;;
|
||||
-cxx)
|
||||
CONFIG_CXX="--enable-cxx"
|
||||
CONFIG_OP="$CONFIG_OP --enable-cxx"
|
||||
;;
|
||||
-fortran)
|
||||
CONFIG_FORTRAN="--enable-fortran"
|
||||
CONFIG_OP="$CONFIG_OP --enable-fortran"
|
||||
;;
|
||||
-pp)
|
||||
CONFIG_PARALLEL="--enable-parallel"
|
||||
CONFIG_OP="$CONFIG_OP --enable-parallel"
|
||||
;;
|
||||
*) # Quit parsing
|
||||
break
|
||||
*) # pass it as a configure option
|
||||
CONFIG_OP="$CONFIG_OP $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
@@ -296,16 +285,12 @@ if [ x-$SRCDIR = x-dummy ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup Configure options
|
||||
CONFIG_OP="$WITH_SZLIB $CONFIG_FORTRAN $CONFIG_CXX $CONFIG_PARALLEL"
|
||||
|
||||
# Configure
|
||||
# no configure if already done.
|
||||
if [ ! -f config.status ]; then
|
||||
CONFIGURE="$CONFIGURE $CONFIG_OP $*"
|
||||
STEP "Configure HDF5..." "$CONFIGURE" "#config"
|
||||
STEP "Configure HDF5..." "$CONFIG_CMD $CONFIG_OP" "#config"
|
||||
else
|
||||
STEP "Confiugre Skipped" "echo Confiugre Skipped" "#config"
|
||||
STEP "Configure Skipped" "echo Configure Skipped" "#config"
|
||||
fi
|
||||
|
||||
if [ x-$CONFIG_ONLY = x-yes ]; then
|
||||
@@ -324,4 +309,3 @@ STEP "Testing HDF5 parallel parts..." "$MAKE check-p" "#test-p"
|
||||
|
||||
# all done
|
||||
echo "No Errors encountered"
|
||||
TIMESTAMP
|
||||
|
||||
66
bin/checkapi
66
bin/checkapi
@@ -17,33 +17,51 @@ require 5.003;
|
||||
|
||||
# Purpose: insures that API functions aren't called internally.
|
||||
# Usage: checkapi H5*.c
|
||||
my $comment = 0;
|
||||
while (<>) {
|
||||
my $filename = "";
|
||||
my $lastname = "";
|
||||
|
||||
# Remove comments within the line.
|
||||
s/\/\*.*?\*\///g;
|
||||
if(<>) {
|
||||
while (<>) {
|
||||
if($ARGV =~ /\//) {
|
||||
($filename) = ($ARGV =~ /^.*\/([A-Za-z0-9_]*)\.c$/);
|
||||
} else {
|
||||
($filename) = ($ARGV =~ /([A-Za-z0-9_]*)\.c$/);
|
||||
}
|
||||
|
||||
# Process comment begin and end tokens on this line.
|
||||
$comment-- if /\*\//; # count comment ends
|
||||
next if $comment; # skip line if in comment
|
||||
$comment++ if /\/\*/; # count comment starts
|
||||
s/(.*)\/\*.*/$1/; # remove comments that begin on this line
|
||||
if($filename =~ /H5FDmulti|H5FDstdio/) {
|
||||
if($filename ne $lastname) {
|
||||
print "$ARGV is exempt from checking\n";
|
||||
$lastname = $filename;
|
||||
}
|
||||
} else {
|
||||
# Get rid of comments by removing the inside part.
|
||||
s|/\*.*?\*/||g;
|
||||
if ($in_comment) {
|
||||
if (/\*\//) {
|
||||
s|.*?\*/||;
|
||||
$in_comment = 0;
|
||||
} else {
|
||||
$_="\n";
|
||||
}
|
||||
} elsif (m|/\*|) {
|
||||
s|/\*.*||;
|
||||
$in_comment = 1;
|
||||
}
|
||||
|
||||
# Remove character strings
|
||||
s/\\.//g; # remove escaped characters
|
||||
s/\".*?\"//g; # remove string constants
|
||||
# Remove character strings
|
||||
s/\\.//g; # remove escaped characters
|
||||
s/\".*?\"//g; # remove string constants
|
||||
|
||||
# Disregard the following hits
|
||||
next if /^H5/;
|
||||
next if /^\#/;
|
||||
next if /FUNC_ENTER(_NOINIT)*/;
|
||||
# Disregard the following hits
|
||||
next if /^H5/;
|
||||
next if /^\#/;
|
||||
next if /FUNC_ENTER(_NOINIT)*/;
|
||||
|
||||
next unless /(H5[A-Z]{1,2}[a-z]\w*)/;
|
||||
print "$ARGV:$.: $1\n";
|
||||
} continue {
|
||||
if (eof) {
|
||||
print "$ARGV:$.: bad comment nesting\n" if $comment;
|
||||
$comment = 0;
|
||||
close ARGV; # reset line number
|
||||
}
|
||||
next unless /(H5[A-Z]{1,2}[a-z]\w*)/;
|
||||
print "$ARGV:$.: $1\n";
|
||||
}
|
||||
} continue {
|
||||
close ARGV if eof; # reset line number
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
121
bin/checkposix
121
bin/checkposix
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/bin/perl -w
|
||||
#!/usr/bin/perl -w
|
||||
require 5.003;
|
||||
|
||||
#
|
||||
@@ -27,60 +27,89 @@ require 5.003;
|
||||
# use `next-error' (usually bound to M-`) to find each name
|
||||
# violation.
|
||||
|
||||
while (<>) {
|
||||
if(<>) {
|
||||
if($ARGV =~ /\//) {
|
||||
($filename) = ($ARGV =~ /^.*\/([A-Za-z0-9_]*)\.c$/);
|
||||
} else {
|
||||
($filename) = ($ARGV =~ /([A-Za-z0-9_]*)\.c$/);
|
||||
}
|
||||
|
||||
# Get rid of comments by removing the inside part.
|
||||
s|/\*.*?\*/||g;
|
||||
if ($in_comment) {
|
||||
if (/\*\//) {
|
||||
s|.*?\*/||;
|
||||
$in_comment = 0;
|
||||
} else {
|
||||
$_="\n";
|
||||
}
|
||||
} elsif (m|/\*|) {
|
||||
s|/\*.*||;
|
||||
$in_comment = 1;
|
||||
}
|
||||
if($filename =~ /H5FDmulti|H5FDstdio/) {
|
||||
print "$ARGV is exempt from using Standard library macro wrappers\n";
|
||||
} else {
|
||||
while (<>) {
|
||||
|
||||
# Get rid of string constants if they begin and end on this line.
|
||||
s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g;
|
||||
# Get rid of comments by removing the inside part.
|
||||
s|/\*.*?\*/||g;
|
||||
if ($in_comment) {
|
||||
if (/\*\//) {
|
||||
s|.*?\*/||;
|
||||
$in_comment = 0;
|
||||
} else {
|
||||
$_="\n";
|
||||
}
|
||||
} elsif (m|/\*|) {
|
||||
s|/\*.*||;
|
||||
$in_comment = 1;
|
||||
}
|
||||
|
||||
# Get rid of preprocessor directives
|
||||
s/^\#.*//;
|
||||
# Get rid of string constants if they begin and end on this line.
|
||||
s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g;
|
||||
|
||||
# Now find all function calls on this line
|
||||
while (($name)=/\b([a-gi-z_A-GI-Z]\w*)\s*\(/) {
|
||||
$_ = $';
|
||||
|
||||
# Ignore C statements that look sort of like function
|
||||
# calls.
|
||||
next if $name =~ /^(if|for|return|sizeof|switch|while|void)$/;
|
||||
# Get rid of preprocessor directives
|
||||
s/^\#.*//;
|
||||
|
||||
# Ignore things that get misdetected because of the simplified
|
||||
# parsing that takes place here.
|
||||
next if $name =~ /^int$/;
|
||||
# Skip callbacks invoked as methods in a struct
|
||||
next if $_ =~ /\b(\)?->|\.)\(?([a-z_A-Z]\w*)\s*\(/;
|
||||
|
||||
# These are really HDF5 functions/macros even though they don't
|
||||
# start with `h' or `H'.
|
||||
next if $name =~ /^FUNC_(ENTER|LEAVE)(_INIT)?$/;
|
||||
next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)$/;
|
||||
next if $name =~ /^(MIN3?|MAX3?|NELMTS|BOUND|CONSTR)$/;
|
||||
next if $name =~ /^IS_H5FD_MPIO$/;
|
||||
next if $name =~ /^addr_defined$/;
|
||||
# Now find all function calls on this line which don't start with 'H'
|
||||
while (($name)=/\b([a-z_A-GI-Z]\w*)\s*\(/) {
|
||||
$_ = $';
|
||||
|
||||
# Ignore C statements that look sort of like function
|
||||
# calls.
|
||||
next if $name =~ /^(if|for|offsetof|return|sizeof|switch|while|void)$/;
|
||||
|
||||
# These functions/macros are exempt.
|
||||
next if $name =~ /^(assert|main|[fs]?printf|va_(start|arg|end))$/;
|
||||
# Ignore things that get misdetected because of the simplified
|
||||
# parsing that takes place here.
|
||||
next if $name =~ /^(int|herr_t|_term_interface)$/;
|
||||
|
||||
# These are MPI function calls. Ignore them.
|
||||
next if $name =~ /^MPI_/;
|
||||
# These are really HDF5 functions/macros even though they don't
|
||||
# start with `h' or `H'.
|
||||
next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT)?(_NOFUNC|_TAG)?$/;
|
||||
next if $name =~ /^(BEGIN|END)_FUNC$/;
|
||||
next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/;
|
||||
next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/;
|
||||
next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/;
|
||||
next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/;
|
||||
next if $name =~ /^(UNIQUE_MEMBERS)$/;
|
||||
next if $name =~ /^addr_defined$/;
|
||||
|
||||
# These are POSIX threads function calls. Ignore them.
|
||||
next if $name =~ /^pthread_/;
|
||||
# These functions/macros are exempt.
|
||||
next if $name =~ /^(main|[fs]?printf|va_(start|arg|end))$/;
|
||||
|
||||
print "$ARGV:$.: $name\n";
|
||||
}
|
||||
# These are Windows system calls. Ignore them.
|
||||
next if $name =~ /^(_get_osfhandle|GetFileInformationByHandle|SetFilePointer|GetLastError|SetEndOfFile)$/;
|
||||
next if $name =~ /^(FindNextFile|FindClose|_tzset|Wgettimeofday|GetSystemTimeAsFileTime|Wgetlogin|GetUserName)$/;
|
||||
|
||||
} continue {
|
||||
close ARGV if eof;
|
||||
# These are MPI function calls. Ignore them.
|
||||
next if $name =~ /^(MPI_|MPE_)/;
|
||||
|
||||
# These are POSIX threads function calls. Ignore them.
|
||||
next if $name =~ /^pthread_/;
|
||||
|
||||
# These are Windows threads function calls. Ignore them.
|
||||
next if $name =~ /^(_beginthread|(Initialize|Enter|Leave)CriticalSection|TlsAlloc)$/;
|
||||
|
||||
# These are zlib & szlib function calls. Ignore them.
|
||||
next if $name =~ /^(inflate|SZ_)/;
|
||||
next if $name =~ /^compress2$/;
|
||||
|
||||
print "$ARGV:$.: $name\n";
|
||||
}
|
||||
|
||||
} continue {
|
||||
close ARGV if eof; # reset line number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
# Created Date: 2004/12/07
|
||||
|
||||
#
|
||||
# Configure: should be generated by autoconf version 2.59.
|
||||
# autoconf: should be of version 2.59.
|
||||
# Configure: should be generated by autoconf version 2.69.
|
||||
# autoconf: should be of version 2.69.
|
||||
|
||||
# variable initialization
|
||||
nerrors=0
|
||||
AUTOCONFVERSION=2.61
|
||||
AUTOCONFVERSION=2.69
|
||||
AUTOCONFVERSIONLEAD='Generated by GNU Autoconf'
|
||||
CONFIGUREFILES="configure"
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ SH_COPYRIGHT=/tmp/h5chkright_SH.$$ # SHELL style copyright
|
||||
SH_COPYRIGHT2=/tmp/h5chkright_SH2.$$ # SHELL style copyright, 2nd style.
|
||||
WINBAT_COPYRIGHT=/tmp/h5chkright_WINBAT.$$ # Windows Batch file Copyright notice
|
||||
VMSCMD_COPYRIGHT=/tmp/h5chkright_VMSCMD.$$ # VMS command file Copyright notice
|
||||
CONFIGURE_IN_COPYRIGHT=/tmp/h5chkright_CONFIGURE_IN.$$ # configure.in file Copyright notice
|
||||
CONFIGURE_AC_COPYRIGHT=/tmp/h5chkright_CONFIGURE_AC.$$ # configure.ac file Copyright notice
|
||||
|
||||
tmpfixfile=/tmp/h5chkright_fix.$$ # Temporary fixed copy of file
|
||||
|
||||
@@ -207,8 +207,8 @@ EOF
|
||||
@REM access to either file, you may request a copy from help@hdfgroup.org.
|
||||
EOF
|
||||
|
||||
# configure.in file Copyright notice
|
||||
cat > ${CONFIGURE_IN_COPYRIGHT} << \EOF
|
||||
# configure.ac file Copyright notice
|
||||
cat > ${CONFIGURE_AC_COPYRIGHT} << \EOF
|
||||
dnl Copyright by The HDF Group.
|
||||
dnl Copyright by the Board of Trustees of the University of Illinois.
|
||||
dnl All rights reserved.
|
||||
@@ -635,10 +635,10 @@ VMSCMD_FILE()
|
||||
|
||||
# Check Configure.in type files
|
||||
#
|
||||
CONFIGURE_IN_FILE()
|
||||
CONFIGURE_AC_FILE()
|
||||
{
|
||||
f=$1
|
||||
case `MATCH_COPYRIGHT $CONFIGURE_IN_COPYRIGHT $f` in
|
||||
case `MATCH_COPYRIGHT $CONFIGURE_AC_COPYRIGHT $f` in
|
||||
PASSED)
|
||||
PASSED $f
|
||||
return
|
||||
@@ -646,9 +646,9 @@ CONFIGURE_IN_FILE()
|
||||
FAILED)
|
||||
# show the difference
|
||||
FAILED $f
|
||||
$DIFF ${EXTRACTEDFILE} ${CONFIGURE_IN_COPYRIGHT}
|
||||
$DIFF ${EXTRACTEDFILE} ${CONFIGURE_AC_COPYRIGHT}
|
||||
if [ -n "$FIXIT" ]; then
|
||||
FIX_COPYRIGHT $CONFIGURE_IN_COPYRIGHT $f
|
||||
FIX_COPYRIGHT $CONFIGURE_AC_COPYRIGHT $f
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -681,8 +681,8 @@ GUESS_File_Type()
|
||||
# Put this after C_SOURCE which may have #define and such lines.
|
||||
echo SHELL_FILE
|
||||
elif grep '^dnl' < $tmpfile > /dev/null; then
|
||||
# Some lines start with a "dnl". It may be a configure.in type file.
|
||||
echo CONFIGURE_IN_FILE
|
||||
# Some lines start with a "dnl". It may be a configure.ac type file.
|
||||
echo CONFIGURE_AC_FILE
|
||||
elif grep -i '^<html>' < $tmpfile > /dev/null || \
|
||||
grep '^<!--' < $tmpfile > /dev/null ; then
|
||||
# Some lines start with a "<html>" or having an html comment tag.
|
||||
@@ -827,8 +827,8 @@ while read file; do
|
||||
*Makefile | *Makefile.in | *Makefile.am | Makefile.dist )
|
||||
MAKE_FILE ${file}
|
||||
;;
|
||||
configure.in )
|
||||
CONFIGURE_IN_FILE ${file}
|
||||
configure.ac )
|
||||
CONFIGURE_AC_FILE ${file}
|
||||
;;
|
||||
*.bat | *.BAT )
|
||||
# Windows Batch files
|
||||
|
||||
159
bin/chkmanifest
159
bin/chkmanifest
@@ -20,75 +20,17 @@
|
||||
|
||||
verbose=yes
|
||||
MANIFEST=/tmp/HD_MANIFEST.$$
|
||||
SVNENTRY=/tmp/HD_SVNENTRY.$$
|
||||
|
||||
# function definitions
|
||||
|
||||
GETSVNENTRIES_13 ()
|
||||
# Purpose: Extract filenames from the svn v1.3.* entries file
|
||||
# $1: directory name in which the svn entries is.
|
||||
# steps:
|
||||
# 1. remove all single line entries so that step 2 does not fail on them.
|
||||
# 2. merge all multiple lines entries into single lines.
|
||||
# 3. remove all non file entries.
|
||||
# 4. insert a blank line because some entries files has no kind="file"
|
||||
# entry and ed does not like to do g on an empty file.
|
||||
# 5. remove everything except the file name.
|
||||
# 6. remove all blank lines, including the inserted one.
|
||||
{
|
||||
cp $1/entries $SVNENTRY
|
||||
chmod u+w $SVNENTRY # entries file is not writable.
|
||||
ed - $SVNENTRY <<EOF
|
||||
g/^<.*>$/d
|
||||
g/^</.,/>$/j
|
||||
v/kind="file"/d
|
||||
a
|
||||
|
||||
.
|
||||
g/.*name="/s///
|
||||
g/".*/s///
|
||||
g/^$/d
|
||||
w
|
||||
q
|
||||
EOF
|
||||
cat $SVNENTRY
|
||||
rm $SVNENTRY
|
||||
}
|
||||
|
||||
GETSVNENTRIES_14 ()
|
||||
# Purpose: Extract filenames from the svn v1.4.* entries file
|
||||
# $1: directory name in which the svn entries is.
|
||||
# steps:
|
||||
# 1. all valid files are followed by a line containing "file" only.
|
||||
# 2. find them by looking for "file" first, then mark its preceding line as
|
||||
# wanted.
|
||||
# 3. remove all non-marked line.
|
||||
# 4. insert a blank line because some entries files has no kind="file"
|
||||
# entry and ed does not like to do g on an empty file.
|
||||
# 5. remove the marks.
|
||||
{
|
||||
cp $1/entries $SVNENTRY
|
||||
chmod u+w $SVNENTRY # entries file is not writable.
|
||||
ed - $SVNENTRY <<EOF
|
||||
g/^file$/-s/^/%WANTED%/
|
||||
v/%WANTED%/d
|
||||
a
|
||||
|
||||
.
|
||||
g/^%WANTED%/s///
|
||||
w
|
||||
q
|
||||
EOF
|
||||
cat $SVNENTRY
|
||||
rm $SVNENTRY
|
||||
}
|
||||
|
||||
|
||||
# Main
|
||||
test "$verbose" && echo " Checking MANIFEST..." 1>&2
|
||||
# clean up $MANIFEST file when exits
|
||||
trap "rm -f $MANIFEST" 0
|
||||
|
||||
# Only split lines on newline, not whitespace
|
||||
set -f
|
||||
IFS='
|
||||
'
|
||||
|
||||
# First make sure i am in the directory in which there is an MANIFEST file
|
||||
# and then do the checking from there. Will try the following,
|
||||
# current directory, parent directory, the directory this command resides.
|
||||
@@ -107,6 +49,21 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for duplicate entries. This can be done at any time, but it may as
|
||||
# well be sooner so that if something else fails the presence of duplicates
|
||||
# will already be known.
|
||||
errcode=0
|
||||
DUPLICATES=`perl -ne 's/#.*//; next if /^\s*$/; if ($uniq{$_}++) { print $_; }' MANIFEST`
|
||||
if [ "$DUPLICATES" ]; then
|
||||
cat 1>&2 <<EOF
|
||||
These entries appear more than once in the MANIFEST:
|
||||
$DUPLICATES
|
||||
Please remove the duplicate lines and try again.
|
||||
|
||||
EOF
|
||||
errcode=1
|
||||
fi
|
||||
|
||||
# Copy the manifest file to get a list of file names.
|
||||
grep '^\.' MANIFEST | expand | cut -f1 -d' ' >$MANIFEST
|
||||
|
||||
@@ -117,35 +74,55 @@ for file in `cat $MANIFEST`; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Inspect the .svn/entries to figure out what version of svn file entry is
|
||||
# used.
|
||||
# The following algorithm is formed via reverse engineering.
|
||||
# I don't know what the official svn format is if such a specification exists.
|
||||
# Algorithm:
|
||||
# If the first line of the file has 'xml version="1.0"' in it, it is created
|
||||
# by svn 1.3 or older; else if it has '^file$' in it, it is created by svn 1.4.
|
||||
svn_entry_file=.svn/entries
|
||||
if head -1 $svn_entry_file | grep 'xml version="1.0"' > /dev/null 2>&1;then
|
||||
getsvnentries=GETSVNENTRIES_13
|
||||
elif grep '^file$' $svn_entry_file > /dev/null 2>&1; then
|
||||
getsvnentries=GETSVNENTRIES_14
|
||||
else
|
||||
echo "Unknow svn entries format. Aborted"
|
||||
exit 1
|
||||
fi
|
||||
# Get the list of files under version control and check that they are
|
||||
# present.
|
||||
#
|
||||
# First get a list of all the pending files with svn stat and
|
||||
# check those.
|
||||
svn_stat=`svn stat -q`
|
||||
for file in $svn_stat; do
|
||||
|
||||
for svn in `find . -type d -name .svn -print`; do
|
||||
path=`echo $svn |sed 's/\/.svn//'`
|
||||
for file in `$getsvnentries $svn`; do
|
||||
if (grep ^$path/$file$ $MANIFEST >/dev/null); then
|
||||
:
|
||||
else
|
||||
echo "+ $path/$file"
|
||||
fail=yes
|
||||
fi
|
||||
done
|
||||
# Newly added files are not listed by svn ls, which
|
||||
# we check later.
|
||||
|
||||
# The line listing new files starts with 'A'.
|
||||
letter=`echo $file | head -c 1`
|
||||
if [ "$letter" = "A" ]; then
|
||||
# Convert the seven Subversion status columns to './' so it matches
|
||||
# the manifest file name.
|
||||
#
|
||||
# There is a space between the status columns and file name, hence
|
||||
# the '8' instead of '7'.
|
||||
path=`echo $file | sed 's/^.\{8\}/\.\//g'`
|
||||
# Ignore directories
|
||||
if [ ! -d $path ]; then
|
||||
if (grep ^$path$ $MANIFEST >/dev/null); then
|
||||
:
|
||||
else
|
||||
echo "- $path"
|
||||
fail=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Next check svn ls, which gets a list of all files that are
|
||||
# checked in.
|
||||
svn_ls=`svn ls -R`
|
||||
for file in $svn_ls; do
|
||||
path="./${file}"
|
||||
# Ignore directories
|
||||
if [ ! -d $path ]; then
|
||||
if (grep ^$path$ $MANIFEST >/dev/null); then
|
||||
:
|
||||
else
|
||||
echo "+ $path"
|
||||
fail=yes
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Finish up
|
||||
if [ "X$fail" = "Xyes" ]; then
|
||||
cat 1>&2 <<EOF
|
||||
The MANIFEST is out of date. Files marked with a minus sign (-) no
|
||||
@@ -155,5 +132,9 @@ EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $errcode -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test "$verbose" && echo " The MANIFEST is up to date." 1>&2
|
||||
exit 0
|
||||
|
||||
554
bin/cmakehdf5
Executable file
554
bin/cmakehdf5
Executable file
@@ -0,0 +1,554 @@
|
||||
#! /bin/sh
|
||||
# Build and Test HDF5 using cmake.
|
||||
# Author: Allen Byrne
|
||||
# Albert Cheng
|
||||
# Creation Date: Nov 2012
|
||||
# Modified:
|
||||
# Changed to use the quick steps described in INSTALL_CMake.txt. (AKC 2014/1/1)
|
||||
|
||||
# Copyright: The HDF Group, 2012-14
|
||||
|
||||
# Debug Print: remove the comment hash if you want DPRINT to do echo
|
||||
DPRINT=:
|
||||
#DPRINT=echo
|
||||
|
||||
# use the ctest scripting method if --script is given
|
||||
if [ "$1" != "--script" ]; then
|
||||
# variable names
|
||||
# The "extra" number is the step number and easier to see all logfiles in
|
||||
# the sorted order of steps
|
||||
progname=`basename $0` # program name
|
||||
configlog="#${progname}_1config.log"
|
||||
makelog="#${progname}_2build.log"
|
||||
testlog="#${progname}_3test.log"
|
||||
packlog="#${progname}_4pack.log"
|
||||
installlog="#${progname}_5install.log"
|
||||
config_summary=libhdf5.settings
|
||||
exit_code=0
|
||||
|
||||
# This command should be in the source directory's bin/
|
||||
# and should have invoked as "$srcdir/bin/$progname" or
|
||||
# "bin/$progname". So, by striping bin/$program from $0,
|
||||
# we can find $srcdir.
|
||||
if [ $0 == bin/$progname ]; then
|
||||
srcdir="." # current directory
|
||||
else
|
||||
# $0 is $srdir/bin/$progname
|
||||
srcdir=`echo $0 | sed -e s%/bin/$progname\$%%`
|
||||
fi
|
||||
# Sanity check
|
||||
if [ ! -r $srcdir/bin/$progname ]; then
|
||||
echo "encountered error while trying to find srcdir($srdir)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Cmake build options
|
||||
cacheinit=$srcdir/config/cmake/cacheinit.cmake
|
||||
build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF # C++ interface default off
|
||||
build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF # Fortran interface default off
|
||||
enable_f2003=-DHDF5_ENABLE_F2003:BOOL=OFF # Fortran2003 interface default off
|
||||
build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON # High Level interface default on
|
||||
build_testing=-DBUILD_TESTING:BOOL=ON # Build tests default on
|
||||
build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON # Build tools default on
|
||||
with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT=ON # enable zlib filter default on
|
||||
with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT=OFF # enables zlib filter default off
|
||||
shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON # enables shared lib; default on
|
||||
|
||||
|
||||
#=============
|
||||
# Function definitions
|
||||
#=============
|
||||
|
||||
# Show user brief help page
|
||||
HELP_BRIEF()
|
||||
{
|
||||
cat << EOF
|
||||
Usage: $progname [options]
|
||||
--help: shows details help page
|
||||
EOF
|
||||
}
|
||||
|
||||
# Show user detail help page
|
||||
HELP()
|
||||
{
|
||||
cat << EOF
|
||||
Usage: $progname [<options>]
|
||||
where options are:
|
||||
--enable-fortran | --disable-fortran:
|
||||
enable or disable fortran API. Default is off.
|
||||
--enable-fortran2003 | --disable-fortran2003:
|
||||
enable or disable fortran2003 API. Default is off.
|
||||
--enable-cxx | --disable-cxx:
|
||||
enable or disable c++ API. Default is off.
|
||||
--enable-hl | --disable-hl:
|
||||
enable or disable high level API. Default is on.
|
||||
--enable-shared | --disable-shared:
|
||||
enable or disable shared lib. Default is on.
|
||||
--enable-tools | --disable-tools:
|
||||
enable or disable building tools. Default is on.
|
||||
--enable-testing | --disable-testing:
|
||||
enable or disable building tests. Default is on.
|
||||
--with-zlib | --without-zlib:
|
||||
Use zlib library for external deflate I/O filter. Default is on.
|
||||
--help: shows details help page
|
||||
EOF
|
||||
}
|
||||
|
||||
# Display a time stamp
|
||||
TIMESTAMP()
|
||||
{
|
||||
echo "=====" "`date`" "====="
|
||||
}
|
||||
|
||||
|
||||
# Do one step bracketed with time stamps
|
||||
# The '< /dev/null' is needed to prevent some applications like MPI
|
||||
# jobs blocked for reading when they read stdin unnecessary.
|
||||
# $1 is banner message to be displayed.
|
||||
# $2 is command to run
|
||||
# $3 is logfile name for saving output from the command
|
||||
STEP()
|
||||
{
|
||||
banner="$1"
|
||||
command="$2"
|
||||
logfile="$3"
|
||||
|
||||
echo "$banner" with output saved in $logfile
|
||||
(TIMESTAMP; nerror=0 ;
|
||||
echo "eval $command"
|
||||
eval $command || nerror=1 ;
|
||||
TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "error in '$banner'. $progname aborted."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Install the generated installation image file. Different platform uses
|
||||
# different image files.
|
||||
# Linux: HDF5-<version>-Linux.sh file
|
||||
# Mac OS X: Not implemented yet
|
||||
# Others: Not implemented yet
|
||||
INSTALL_HDF5()
|
||||
{
|
||||
myos="`uname -s`"
|
||||
case "$myos" in
|
||||
Linux)
|
||||
install_file=./HDF5-${version}-Linux.sh
|
||||
$install_file --skip-license $*
|
||||
;;
|
||||
Darwin) # Mac OSX DMG file
|
||||
install_file=HDF5-${version}-Darwin.dmg
|
||||
test -d hdf5 || mkdir hdf5
|
||||
basename=`basename $install_file .dmg`
|
||||
# mount the DMG file as /Volumes/$basename
|
||||
# echo 'Y' as yes for license.
|
||||
echo Y | hdiutil mount $install_file
|
||||
# copy the contents to the install location
|
||||
cp -R "/Volumes/$basename/HDF_Group" hdf5
|
||||
# unmount the DMG file
|
||||
hdiutil unmount /Volumes/$basename
|
||||
;;
|
||||
*) # unknown/unsupported OS.
|
||||
echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#==========
|
||||
# main
|
||||
#==========
|
||||
|
||||
# Show a start time stamp
|
||||
TIMESTAMP
|
||||
|
||||
# Parse Cmake configure options
|
||||
# --enable-XXX or --disable-XXX will enable or disable feature XXX.
|
||||
# XXX can be:
|
||||
# fortran Fortran interface
|
||||
# cxx C++ interface
|
||||
# hl Highlevel interface
|
||||
# testing Build tests
|
||||
# tools Build tools
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--enable-fortran)
|
||||
build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON
|
||||
;;
|
||||
--disable-fortran)
|
||||
build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF
|
||||
;;
|
||||
--enable-fortran2003)
|
||||
enable_f2003=-DHDF5_ENABLE_F2003:BOOL=ON
|
||||
;;
|
||||
--disable-fortran2003)
|
||||
enable_f2003=-DHDF5_ENABLE_F2003:BOOL=OFF
|
||||
;;
|
||||
--enable-cxx)
|
||||
build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON
|
||||
;;
|
||||
--disable-cxx)
|
||||
build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF
|
||||
;;
|
||||
--enable-hl)
|
||||
build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON
|
||||
;;
|
||||
--disable-hl)
|
||||
build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF
|
||||
;;
|
||||
--enable-shared)
|
||||
shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON
|
||||
;;
|
||||
--disable-shared)
|
||||
shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
;;
|
||||
--enable-tools)
|
||||
build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON
|
||||
;;
|
||||
--disable-tools)
|
||||
build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF
|
||||
;;
|
||||
--enable-testing)
|
||||
build_testing=-DBUILD_TESTING:BOOL=ON
|
||||
;;
|
||||
--disable-testing)
|
||||
build_testing=-DBUILD_TESTING:BOOL=OFF
|
||||
;;
|
||||
--with-zlib)
|
||||
with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON
|
||||
;;
|
||||
--without-zlib)
|
||||
with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF
|
||||
;;
|
||||
--help)
|
||||
# print the detail help page and exit
|
||||
HELP
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown options: $1"
|
||||
HELP
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Always display the brief help page
|
||||
HELP_BRIEF
|
||||
|
||||
# Verify there is a valid hdf5 source directory present
|
||||
if [ ! -d $srcdir ]; then
|
||||
echo $srcdir not found. Aborted.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# figure out version information
|
||||
vers=bin/h5vers
|
||||
if [ ! -x $srcdir/$vers ]; then
|
||||
echo $srcdir/$vers not found or not executable. Aborted.
|
||||
exit 1
|
||||
fi
|
||||
version=`cd $srcdir; $vers`
|
||||
if [ $? != 0 ]; then
|
||||
echo $vers failed. Aborted.
|
||||
exit 1
|
||||
fi
|
||||
echo Running Cmake for HDF5-${version} ...
|
||||
# 4. Configure the C library, tools and tests with this command:
|
||||
# If successful, append the configure summary to the configure logfile.
|
||||
STEP "Configure..." "cmake \
|
||||
-C $cacheinit \
|
||||
$build_cpp_lib \
|
||||
$build_fortran \
|
||||
$enable_f2003 \
|
||||
$build_hl_lib \
|
||||
$shared_lib \
|
||||
$build_testing \
|
||||
$build_tools \
|
||||
$with_zlib \
|
||||
$with_szlib \
|
||||
$srcdir" $configlog &&\
|
||||
cat $config_summary >> $configlog
|
||||
|
||||
# 5. Build the C library, tools and tests with this command:
|
||||
STEP "Build the library, tools and tests, ..." "cmake --build . --config Release" $makelog
|
||||
|
||||
# 6. Test the C library and tools with this command:
|
||||
STEP "Test the library and tools..." "ctest . -C Release" $testlog
|
||||
|
||||
# 7. Create an install image with this command:
|
||||
STEP "Create an install image..." "cpack -C Release CPackConfig.cmake" $packlog
|
||||
|
||||
# 8. Install with this command:
|
||||
#STEP "Install..." "./HDF5-${version}-Linux.sh --skip-license" $installlog
|
||||
STEP "Install..." "INSTALL_HDF5" $installlog
|
||||
# save the last exit code
|
||||
exit_code=$?
|
||||
|
||||
# Show a closing time stamp
|
||||
TIMESTAMP
|
||||
exit $exit_code
|
||||
|
||||
else
|
||||
# ---------------
|
||||
# older version
|
||||
# ---------------
|
||||
|
||||
# variable names
|
||||
progname=`basename $0` # program name
|
||||
cminfile="cmakemin.$$" # Cmake minimum file
|
||||
cfgfile=$progname.$$ # configure file
|
||||
ctest_log=ctest.log # output of ctest script
|
||||
install_log=install.log # output of installation
|
||||
$DPRINT $cfgfile
|
||||
|
||||
# Remove temporary generated files if exit 0
|
||||
trap "rm -f $cminfile $cfgfile" 0
|
||||
|
||||
#=============
|
||||
# Function definitions
|
||||
#=============
|
||||
TIMESTAMP()
|
||||
{
|
||||
echo "=====" "`date`" "====="
|
||||
}
|
||||
|
||||
|
||||
#==========
|
||||
# main
|
||||
#==========
|
||||
# Show a start time stamp
|
||||
TIMESTAMP
|
||||
|
||||
# Explain what and where log files are.
|
||||
cat <<EOF
|
||||
$ctest_log: output of ctest script.
|
||||
$install_log: output of installation
|
||||
Log files will be stored in Testing/Temporary:
|
||||
LastConfigure_<timestamp>.log: output of configure
|
||||
LastBuild_<timestamp>.log: output of build
|
||||
LastTest_<timestamp>.log: output of testing
|
||||
LastTestsFailed_<timestamp>.log: list of failed tests
|
||||
|
||||
EOF
|
||||
|
||||
# First generate the two needed input files, the $cimnfile and $cfgfile.
|
||||
# Then use ctest to use the two input files.
|
||||
|
||||
#==========
|
||||
# create the configure file
|
||||
#==========
|
||||
# Create the cmake minimum required file to be used by the following
|
||||
# configure file. Though not absolute needed, it is better to generate
|
||||
# this file before the configure file. Quote the EOF to preven substitution
|
||||
# in the text.
|
||||
#==========
|
||||
#==========
|
||||
cat > $cfgfile <<'EOF'
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
########################################################
|
||||
# This dashboard is maintained by The HDF Group
|
||||
# For any comments please contact cdashhelp@hdfgroup.org
|
||||
#
|
||||
########################################################
|
||||
|
||||
set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
|
||||
set (CTEST_SOURCE_DIRECTORY "../hdf5")
|
||||
set (CTEST_BINARY_DIRECTORY ".")
|
||||
set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
|
||||
set (CTEST_BUILD_CONFIGURATION "Release")
|
||||
set (CTEST_MAX_N 8)
|
||||
|
||||
# -- CDash variables
|
||||
set (LOCAL_NO_SUBMIT TRUE) # No CDash submit.
|
||||
set (MODEL "Experimental")
|
||||
set (CDASH_LOCAL TRUE)
|
||||
set (SITE_BUILDNAME_SUFFIX "cmakehdf5")
|
||||
|
||||
# -- URL set for internal check, default is to not update
|
||||
set (LOCAL_SKIP_UPDATE TRUE)
|
||||
set (REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8")
|
||||
# -- Standard build options
|
||||
set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
|
||||
|
||||
# Use multiple CPU cores to build
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(N)
|
||||
if(NOT N EQUAL 0)
|
||||
if(N GREATER ${CTEST_MAX_N})
|
||||
set(N ${CTEST_MAX_N})
|
||||
endif(N GREATER ${CTEST_MAX_N})
|
||||
set(CTEST_BUILD_FLAGS -j${N})
|
||||
set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# -- Get environment
|
||||
# -----------------------------------------------------------
|
||||
## -- set hostname
|
||||
## --------------------------
|
||||
find_program (HOSTNAME_CMD NAMES hostname)
|
||||
exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
|
||||
set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}")
|
||||
find_program (UNAME NAMES uname)
|
||||
macro (getuname name flag)
|
||||
exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
|
||||
endmacro (getuname)
|
||||
|
||||
getuname (osname -s)
|
||||
getuname (osrel -r)
|
||||
getuname (cpu -m)
|
||||
|
||||
if (SITE_BUILDNAME_SUFFIX)
|
||||
set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}-${SITE_BUILDNAME_SUFFIX}")
|
||||
else (SITE_BUILDNAME_SUFFIX)
|
||||
set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}")
|
||||
endif (SITE_BUILDNAME_SUFFIX)
|
||||
# -----------------------------------------------------------
|
||||
|
||||
set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# MAC machines need special option
|
||||
#-----------------------------------------------------------------------------
|
||||
if (APPLE)
|
||||
# Compiler choice
|
||||
execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
SET(ENV{CC} "${XCODE_CC}")
|
||||
SET(ENV{CXX} "${XCODE_CXX}")
|
||||
# Shared fortran is not supported, build static
|
||||
set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
|
||||
set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
# -----------------------------------------------------------
|
||||
find_package (Subversion)
|
||||
set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}")
|
||||
# -- Only clean build folder if LOCAL_CLEAR_BUILD is set
|
||||
if (LOCAL_CLEAR_BUILD)
|
||||
set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
|
||||
ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY})
|
||||
endif (LOCAL_CLEAR_BUILD)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Send the main script as a note.
|
||||
list (APPEND CTEST_NOTES_FILES
|
||||
"${CMAKE_CURRENT_LIST_FILE}"
|
||||
"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
|
||||
)
|
||||
|
||||
# Check for required variables.
|
||||
foreach (req
|
||||
CTEST_CMAKE_GENERATOR
|
||||
CTEST_SITE
|
||||
CTEST_BUILD_NAME
|
||||
)
|
||||
if (NOT DEFINED ${req})
|
||||
message(FATAL_ERROR "The containing script must set ${req}")
|
||||
endif (NOT DEFINED ${req})
|
||||
endforeach (req)
|
||||
|
||||
## -- set output to english
|
||||
set($ENV{LC_MESSAGES} "en_EN")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Initialize the CTEST commands
|
||||
#------------------------------
|
||||
set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
|
||||
set (CTEST_CONFIGURE_COMMAND
|
||||
"${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"")
|
||||
|
||||
# Print summary information.
|
||||
foreach (v
|
||||
CTEST_SITE
|
||||
CTEST_BUILD_NAME
|
||||
CTEST_SOURCE_DIRECTORY
|
||||
CTEST_BINARY_DIRECTORY
|
||||
CTEST_CMAKE_GENERATOR
|
||||
CTEST_BUILD_CONFIGURATION
|
||||
CTEST_CONFIGURE_COMMAND
|
||||
CTEST_SCRIPT_DIRECTORY
|
||||
)
|
||||
set (vars "${vars} ${v}=[${${v}}]\n")
|
||||
endforeach (v)
|
||||
message ("Dashboard script configuration:\n${vars}\n")
|
||||
|
||||
CTEST_START (${MODEL} TRACK ${MODEL})
|
||||
if (NOT LOCAL_SKIP_UPDATE)
|
||||
CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}")
|
||||
endif (NOT LOCAL_SKIP_UPDATE)
|
||||
CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
|
||||
if(NOT res STREQUAL "0")
|
||||
message (FATAL_ERROR "Configure FAILED")
|
||||
endif()
|
||||
message ("Configure DONE")
|
||||
CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}")
|
||||
if (NOT LOCAL_NO_SUBMIT)
|
||||
CTEST_SUBMIT (PARTS Update Configure Notes)
|
||||
endif (NOT LOCAL_NO_SUBMIT)
|
||||
CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res)
|
||||
if (NOT LOCAL_NO_SUBMIT)
|
||||
CTEST_SUBMIT (PARTS Build)
|
||||
endif (NOT LOCAL_NO_SUBMIT)
|
||||
if(NOT res STREQUAL "0")
|
||||
message (FATAL_ERROR "Build FAILED")
|
||||
endif()
|
||||
message ("build DONE")
|
||||
if (NOT LOCAL_SKIP_TEST)
|
||||
CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
|
||||
if (NOT LOCAL_NO_SUBMIT)
|
||||
CTEST_SUBMIT (PARTS Test)
|
||||
endif (NOT LOCAL_NO_SUBMIT)
|
||||
if(NOT res STREQUAL "0")
|
||||
message (FATAL_ERROR "Test FAILED")
|
||||
endif()
|
||||
message ("test DONE")
|
||||
endif (NOT LOCAL_SKIP_TEST)
|
||||
if(NOT LOCAL_MEMCHECK_TEST)
|
||||
##-----------------------------------------------
|
||||
## Package the product
|
||||
##-----------------------------------------------
|
||||
execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V
|
||||
WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
|
||||
RESULT_VARIABLE cpackResult
|
||||
OUTPUT_VARIABLE cpackLog
|
||||
ERROR_VARIABLE cpackLog.err
|
||||
)
|
||||
file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}")
|
||||
endif(NOT LOCAL_MEMCHECK_TEST)
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
message ("DONE")
|
||||
EOF
|
||||
|
||||
|
||||
# Run ctest
|
||||
ctest -S $cfgfile -C Release -V -O $ctest_log
|
||||
exit_code=$?
|
||||
if [ $exit_code = 0 ]; then
|
||||
echo CTest script completed without error
|
||||
else
|
||||
echo Error encountered CTest script
|
||||
fi
|
||||
# Using HDF5-*.sh because actual name is unavailable
|
||||
install_sh=HDF5-*.sh
|
||||
echo installing with $install_sh ...
|
||||
./$install_sh --skip-license > $install_log
|
||||
exit_code=$?
|
||||
if [ $exit_code = 0 ]; then
|
||||
echo Complete without error
|
||||
else
|
||||
echo Error encountered
|
||||
fi
|
||||
TIMESTAMP
|
||||
exit $exit_code
|
||||
|
||||
fi
|
||||
|
||||
101
bin/config.guess
vendored
101
bin/config.guess
vendored
@@ -1,9 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2005-12-13'
|
||||
timestamp='2008-01-23'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -55,8 +56,8 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@@ -106,7 +107,7 @@ set_cc_for_build='
|
||||
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
||||
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
||||
: ${TMPDIR=/tmp} ;
|
||||
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
||||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
||||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
|
||||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
||||
@@ -160,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
arm*) machine=arm-unknown ;;
|
||||
sh3el) machine=shl-unknown ;;
|
||||
sh3eb) machine=sh-unknown ;;
|
||||
sh5el) machine=sh5le-unknown ;;
|
||||
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
||||
esac
|
||||
# The Operating System including object format, if it has switched
|
||||
@@ -206,8 +208,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:ekkoBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:SolidBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
macppc:MirBSD:*:*)
|
||||
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
||||
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:MirBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
||||
@@ -325,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
@@ -527,7 +532,7 @@ EOF
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[45])
|
||||
*:AIX:*:[456])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
@@ -764,12 +769,19 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
case ${UNAME_MACHINE} in
|
||||
pc98)
|
||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
amd64)
|
||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
esac
|
||||
exit ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
i*:MINGW*:*)
|
||||
i*:CYGWIN*:* | x*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
@@ -779,9 +791,18 @@ EOF
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
x86:Interix*:[345]*)
|
||||
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
|
||||
exit ;;
|
||||
*:Interix*:[3456]*)
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
EM64T | authenticamd)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
IA64)
|
||||
echo ia64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
esac ;;
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit ;;
|
||||
@@ -794,7 +815,7 @@ EOF
|
||||
i*:UWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-uwin
|
||||
exit ;;
|
||||
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
|
||||
amd64:CYGWIN*:*:*)
|
||||
echo x86_64-unknown-cygwin
|
||||
exit ;;
|
||||
p*:CYGWIN*:*)
|
||||
@@ -815,6 +836,16 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
@@ -851,7 +882,11 @@ EOF
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
mips64:Linux:*:*)
|
||||
@@ -870,7 +905,11 @@ EOF
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
@@ -925,6 +964,9 @@ EOF
|
||||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
@@ -967,7 +1009,7 @@ EOF
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
#else
|
||||
#if defined(__INTEL_COMPILER) || defined(__PGI)
|
||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
LIBC=gnu
|
||||
#else
|
||||
LIBC=gnuaout
|
||||
@@ -977,7 +1019,11 @@ EOF
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^LIBC/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${LIBC}" != x && {
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit
|
||||
@@ -1179,6 +1225,15 @@ EOF
|
||||
SX-6:SUPER-UX:*:*)
|
||||
echo sx6-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-7:SUPER-UX:*:*)
|
||||
echo sx7-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-8:SUPER-UX:*:*)
|
||||
echo sx8-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SX-8R:SUPER-UX:*:*)
|
||||
echo sx8r-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
Power*:Rhapsody:*:*)
|
||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@@ -1429,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize
|
||||
the operating system you are using. It is advised that you
|
||||
download the most up to date version of the config scripts from
|
||||
|
||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
and
|
||||
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
|
||||
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
If the version you run ($0) is already up to date, please
|
||||
send the following data and any information you think might be
|
||||
|
||||
123
bin/config.sub
vendored
123
bin/config.sub
vendored
@@ -1,9 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2005-12-11'
|
||||
timestamp='2008-01-16'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -71,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@@ -240,15 +241,16 @@ case $basic_machine in
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore | mep \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@@ -268,26 +270,25 @@ case $basic_machine in
|
||||
| mn10200 | mn10300 \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m32c)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
@@ -317,18 +318,18 @@ case $basic_machine in
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* \
|
||||
| avr-* | avr32-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* | m32rle-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
@@ -350,28 +351,31 @@ case $basic_machine in
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
m32c-*)
|
||||
# Recognize the basic CPU types without company name, with glob match.
|
||||
xtensa*)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
@@ -443,6 +447,14 @@ case $basic_machine in
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
blackfin)
|
||||
basic_machine=bfin-unknown
|
||||
os=-linux
|
||||
;;
|
||||
blackfin-*)
|
||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
@@ -475,8 +487,8 @@ case $basic_machine in
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16c)
|
||||
basic_machine=cr16c-unknown
|
||||
cr16)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
crds | unos)
|
||||
@@ -668,6 +680,14 @@ case $basic_machine in
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
;;
|
||||
m68knommu-*)
|
||||
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
@@ -683,6 +703,10 @@ case $basic_machine in
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
basic_machine=arm-unknown
|
||||
os=-mingw32ce
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
@@ -809,6 +833,14 @@ case $basic_machine in
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
parisc)
|
||||
basic_machine=hppa-unknown
|
||||
os=-linux
|
||||
;;
|
||||
parisc-*)
|
||||
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
@@ -818,6 +850,12 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pc98)
|
||||
basic_machine=i386-pc
|
||||
;;
|
||||
pc98-*)
|
||||
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
@@ -904,6 +942,10 @@ case $basic_machine in
|
||||
sb1el)
|
||||
basic_machine=mipsisa64sb1el-unknown
|
||||
;;
|
||||
sde)
|
||||
basic_machine=mipsisa32-sde
|
||||
os=-elf
|
||||
;;
|
||||
sei)
|
||||
basic_machine=mips-sei
|
||||
os=-seiux
|
||||
@@ -915,6 +957,9 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sh5el)
|
||||
basic_machine=sh5le-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
@@ -1004,6 +1049,10 @@ case $basic_machine in
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=tile-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
@@ -1120,7 +1169,7 @@ case $basic_machine in
|
||||
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b)
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -1193,7 +1242,8 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
@@ -1208,7 +1258,7 @@ case $os in
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1360,6 +1410,12 @@ else
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
score-*)
|
||||
os=-elf
|
||||
;;
|
||||
spu-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
@@ -1369,9 +1425,9 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
@@ -1397,6 +1453,9 @@ case $basic_machine in
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# How to create a parallel version of HDF5 on an IBM SP system
|
||||
# that uses MPI and MPI-IO.
|
||||
|
||||
# Unfortunately, the configure/make process to create the parallel version of
|
||||
# HDF5 has not yet been automated to the same extent that the sequential
|
||||
# version has.
|
||||
# Read the INSTALL file to understand the configure/make process for the
|
||||
# sequential (i.e., uniprocess) version of HDF5.
|
||||
# The process for creating the parallel version of HDF5 using MPI-IO
|
||||
# is similar, but first you will have to set up some environment variables
|
||||
# with values specific to your local installation.
|
||||
# The relevant variables are shown below, with values that work for LLNL's
|
||||
# ASCI baby blue pacific SP as of the writing of these instructions (980210).
|
||||
|
||||
# In addition to the environment variables, you _might_ also have to
|
||||
# create a new file in the config directory.
|
||||
# You will need to create this file only if the execution of the ./configure
|
||||
# program aborts with an error after printing the message
|
||||
# "checking whether byte ordering is bigendian..."
|
||||
#
|
||||
# If this is the case, create a new file in the config directory
|
||||
# whose name is of the form architecture-vendor-OSversion
|
||||
# (e.g., for baby blue pacific, this file is named powerpc-ibm-aix4.2.1.0)
|
||||
# and which contains the line
|
||||
# ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
|
||||
# if the target architecture is bigendian, or
|
||||
# ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
|
||||
# otherwise.
|
||||
# Running the program ./bin/config.guess will print out the name
|
||||
# of the new file you must create.
|
||||
|
||||
# Don't try to make a parallel version of HDF5 from the same hdf5 root
|
||||
# directory where you made a sequential version of HDF5 -- start with
|
||||
# a fresh copy.
|
||||
# Here are the flags you must set before running the ./configure program
|
||||
# to create the parallel version of HDF5.
|
||||
# (We use csh here, but of course you can adapt to whatever shell you like.)
|
||||
|
||||
# compile for MPI jobs
|
||||
setenv CC "/usr/local/mpich-1.1.2+romio_lgfiles/bin/mpicc"
|
||||
|
||||
#
|
||||
# next 4 for IBM mpi
|
||||
#
|
||||
#setenv CC /usr/lpp/ppe.poe/bin/mpcc_r
|
||||
|
||||
#
|
||||
# for both
|
||||
#
|
||||
setenv MP_PROCS 1
|
||||
|
||||
|
||||
# These compiler flags work on ASCI baby blue pacific (IBM SP),
|
||||
# using IBM's MPI and Argonne's MPI-IO (ROMIO):
|
||||
# -DHAVE_FUNCTION compiler accepts __FUNCTION__ notation
|
||||
# -I/usr/local/mpio/include/ibm using ROMIO's MPI-IO header files
|
||||
#
|
||||
# The following flags are only needed when compiling/linking a user program
|
||||
# for execution.
|
||||
# -bI:/usr/include/piofs/piofs.exp this MPI-IO uses PIOFS file system
|
||||
# -L/usr /local/mpio/lib/ibm -lmpio link to this MPI-IO lib
|
||||
#
|
||||
#setenv CFLAGS "-D_LARGE_FILES $CFLAGS"
|
||||
|
||||
# The configure/make process needs to be able to run some programs,
|
||||
# need to specify a processor pool.
|
||||
# Also, don't prepend the process id in the output of the programs
|
||||
# run by config/make.
|
||||
setenv MP_RMPOOL 0
|
||||
setenv MP_LABELIO no
|
||||
|
||||
# Once these variables are set to the proper values for your installation,
|
||||
# you can run the configure program (i.e., ./configure)
|
||||
# to set up the Makefiles, etc.
|
||||
# After configuring, run the make as described in the INSTALL file.
|
||||
# Once the configuration is complete, you can set any of your
|
||||
# environment variables to whatever you like.
|
||||
|
||||
# the files in the config directory, such as
|
||||
# config/powerpc-ibm-aix4.2.1.0
|
||||
# config/powerpc-ibm-aix4.x
|
||||
# config/powerpc-ibm-aix4.3.2.0
|
||||
# sometimes will need some help depending on subtlties of the installation
|
||||
|
||||
|
||||
# When compiling and linking your application, don't forget to compile with
|
||||
# mpcc and link to the MPI-IO library and the parallel version of the HDF5
|
||||
# library (that was created and installed with the configure/make process).
|
||||
96
bin/genltanalyze
Executable file
96
bin/genltanalyze
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/sh
|
||||
##
|
||||
## 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
|
||||
## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
|
||||
##
|
||||
# regenerate hl/src/H5LTanalyze.c
|
||||
|
||||
# HDF5 currently uses the following versions of the bison flex:
|
||||
BISON_VERSION="bison (GNU Bison) 2.7"
|
||||
FLEX_VERSION="flex 2.5.37"
|
||||
|
||||
# If paths to bison flex are not specified by the user, assume tools are
|
||||
# running on jam in /mnt/hdf/packages and set paths accordingly.
|
||||
if test -z ${BISON}; then
|
||||
BISON=/usr/hdf/bin/bison
|
||||
fi
|
||||
if test -z ${FLEX}; then
|
||||
FLEX=/usr/hdf/bin/flex
|
||||
fi
|
||||
|
||||
# Check version numbers of all bison flex against the "correct" versions
|
||||
BI_VERS=`${BISON} --version 2>&1 | grep "^${BISON_VERSION}"`
|
||||
if test -z "${BI_VERS}"; then
|
||||
echo "${BISON} version is not ${BISON_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
FL_VERS=`${FLEX} --version 2>&1 | grep "^${FLEX_VERSION}"`
|
||||
if test -z "${FL_VERS}"; then
|
||||
echo "${FLEX} version is not ${FLEX_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure that the tools are in the path.
|
||||
BISON_DIR=`dirname ${BISON}`
|
||||
FLEX_DIR=`dirname ${FLEX}`
|
||||
|
||||
# Main body
|
||||
cd hl/src
|
||||
echo "Generate hl/src/H5LTparse.c from hl/src/H5LTparse.y"
|
||||
bison -pH5LTyy -o H5LTparse.c -d H5LTparse.y
|
||||
echo "Generate hl/src/H5LTanalyze.c from hl/src/H5LTanalyze.l"
|
||||
flex --nounistd -PH5LTyy -oH5LTanalyze.c H5LTanalyze.l
|
||||
|
||||
# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t
|
||||
# instead of int. Currently the generated function H5LTyyparse is
|
||||
# generated with a return value of type int, which is a mapping to the
|
||||
# flex yyparse function. The return value in the HL library should be
|
||||
# an hid_t.
|
||||
# I propose to not use flex to generate this function, but for now I am
|
||||
# adding a perl command to find and replace this function declaration in
|
||||
# H5LTparse.c.
|
||||
perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' H5LTparse.c
|
||||
perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' H5LTparse.c
|
||||
|
||||
# Add code that disables warnings in the flex/bison-generated code.
|
||||
#
|
||||
# Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions
|
||||
# will simply ignore them, but we want to avoid those warnings.
|
||||
for f in H5LTparse.c H5LTanalyze.c
|
||||
do
|
||||
echo '#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2 ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wmissing-prototypes" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wnested-externs" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wold-style-definition" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wsign-compare" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wsign-conversion" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wstrict-prototypes" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wswitch-default" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wunused-function" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wunused-macros" ' >> tmp.out
|
||||
echo '#pragma GCC diagnostic ignored "-Wunused-parameter" ' >> tmp.out
|
||||
echo '#elif defined __SUNPRO_CC ' >> tmp.out
|
||||
echo '#pragma disable_warn ' >> tmp.out
|
||||
echo '#elif defined _MSC_VER ' >> tmp.out
|
||||
echo '#pragma warning(push, 1) ' >> tmp.out
|
||||
echo '#endif ' >> tmp.out
|
||||
|
||||
cat $f >> tmp.out
|
||||
mv tmp.out $f
|
||||
done
|
||||
|
||||
cd ../..
|
||||
|
||||
exit 0
|
||||
81
bin/h5vers
81
bin/h5vers
@@ -71,7 +71,7 @@ use strict;
|
||||
# the command line) then the first line of the README.txt and RELEASE.txt files
|
||||
# one directory above the H5public.h file is also modified so it looks
|
||||
# something like: This is hdf5-1.2.3-pre1 currently under development.
|
||||
# The AC_INIT macro in configure.in will also change in this case to be
|
||||
# The AC_INIT macro in configure.ac will also change in this case to be
|
||||
# something like: AC_INIT([HDF5], [hdf5-1.2.3-pre1], [help@hdfgroup.org])
|
||||
# Version changes are also reflected in the Windows-maintained H5pubconf.h
|
||||
# file.
|
||||
@@ -159,10 +159,10 @@ while ($_ = shift) {
|
||||
die "mutually exclusive options given\n" if $set && $inc;
|
||||
|
||||
# Determine file to use as H5public.h, README.txt,
|
||||
# release_docs/RELEASE.txt, configure.in, windows/src/H5pubconf.h,
|
||||
# vms/src/h5pubcof.h and config/lt_vers.am.
|
||||
# The README.txt, release_docs/RELEASE.txt, configure.in,
|
||||
# windows/src/H5pubconf.h, vms/src/h5pubconf.h and config/lt_vers.am
|
||||
# release_docs/RELEASE.txt, configure.ac, windows/src/H5pubconf.h
|
||||
# and config/lt_vers.am.
|
||||
# The README.txt, release_docs/RELEASE.txt, configure.ac,
|
||||
# windows/src/H5pubconf.h, and config/lt_vers.am
|
||||
# files are always in the directory above H5public.h
|
||||
unless ($file) {
|
||||
for (@files) {
|
||||
@@ -183,18 +183,14 @@ die "unable to read file: $README\n" unless -r $file;
|
||||
my $RELEASE = $file;
|
||||
$RELEASE =~ s/[^\/]*$/..\/release_docs\/RELEASE.txt/;
|
||||
die "unable to read file: $RELEASE\n" unless -r $file;
|
||||
# configure.in
|
||||
# configure.ac
|
||||
my $CONFIGURE = $file;
|
||||
$CONFIGURE =~ s/[^\/]*$/..\/configure.in/;
|
||||
$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/;
|
||||
die "unable to read file: $H5VMSPUBCONF\n" unless -r $file;
|
||||
# cpp_doc_config
|
||||
my $CPP_DOC_CONFIG = $file;
|
||||
$CPP_DOC_CONFIG =~ s/[^\/]*$/..\/c++\/src\/cpp_doc_config/;
|
||||
die "unable to read file: $CPP_DOC_CONFIG\n" unless -r $file;
|
||||
|
||||
# Get the current version number.
|
||||
open FILE, $file or die "unable to open $file: $!\n";
|
||||
@@ -242,9 +238,8 @@ if ($set) {
|
||||
$README = "";
|
||||
$RELEASE = "";
|
||||
$CONFIGURE = "";
|
||||
$H5PUBCONF = "";
|
||||
$H5VMSPUBCONF = "";
|
||||
$LT_VERS = "";
|
||||
$CPP_DOC_CONFIG = "";
|
||||
$LT_VERS = "";
|
||||
@newver = @curver;
|
||||
}
|
||||
|
||||
@@ -319,6 +314,46 @@ if ($RELEASE) {
|
||||
close FILE;
|
||||
}
|
||||
|
||||
# Update the c++/src/cpp_doc_config file
|
||||
if ($CPP_DOC_CONFIG) {
|
||||
my $data = read_file($CPP_DOC_CONFIG);
|
||||
my $version_string = sprintf("HDF5 version %d.%d.%d%s %s",
|
||||
@newver[0,1,2],
|
||||
$newver[3] eq "" ? "" : "-".$newver[3],
|
||||
"currently under development");
|
||||
|
||||
$data =~ s/PROJECT_NUMBER\s*=.*/PROJECT_NUMBER = $version_string/;
|
||||
|
||||
write_file($CPP_DOC_CONFIG, $data);
|
||||
}
|
||||
|
||||
# helper function to read the file for updating c++/src/cpp_doc_config file.
|
||||
# The version string in that file is not at the top, so the string replacement
|
||||
# is not for the first line, and reading/writing the entire file as one string
|
||||
# facilitates the substring replacement.
|
||||
sub read_file {
|
||||
my ($filename) = @_;
|
||||
|
||||
open my $in, $filename or die "Could not open '$filename' for reading $!";
|
||||
local $/ = undef;
|
||||
my $all = <$in>;
|
||||
close $in;
|
||||
|
||||
return $all;
|
||||
}
|
||||
|
||||
# helper function to write the file for updating c++/src/cpp_doc_config file.
|
||||
sub write_file {
|
||||
my ($filename, $content) = @_;
|
||||
|
||||
open my $out, ">$filename" or die "Could not open '$filename' for writing $!";;
|
||||
print $out $content;
|
||||
close $out;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub gen_configure {
|
||||
my ($name, $conf) = @_;
|
||||
|
||||
@@ -339,7 +374,7 @@ sub gen_configure {
|
||||
print FILE @contents;
|
||||
close FILE;
|
||||
|
||||
$conf =~ /^(.*?)\/?configure.in$/;
|
||||
$conf =~ /^(.*?)\/?configure.ac$/;
|
||||
|
||||
if ($1) {
|
||||
$rc = system("cd $1 && bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
|
||||
@@ -352,7 +387,7 @@ sub gen_configure {
|
||||
}
|
||||
}
|
||||
|
||||
# Update the configure.in files and regenerate them
|
||||
# Update the configure.ac files and regenerate them
|
||||
gen_configure("HDF5", $CONFIGURE) if $CONFIGURE;
|
||||
|
||||
sub gen_h5pubconf {
|
||||
@@ -392,12 +427,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;
|
||||
|
||||
# Print the new version number
|
||||
if ($verbose) {
|
||||
printf("version %d.%d release %d%s\n", @newver[0,1,2],
|
||||
|
||||
669
bin/install-sh
669
bin/install-sh
@@ -1,251 +1,520 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
# from scratch.
|
||||
|
||||
nl='
|
||||
'
|
||||
IFS=" "" $nl"
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
doit=${DOITPROG-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
stripcmd=
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
|
||||
-T) no_target_directory=true;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
true
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
pathcomp=''
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
||||
@@ -67,33 +67,6 @@ case "$OSname" in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
IRIX)
|
||||
swpaths="/afs/ncsa/packages/hdf/IRIX_6.5"
|
||||
;;
|
||||
IRIX64)
|
||||
case "$CC" in
|
||||
cc|"") #default cc
|
||||
abi=`cc -show_defaults 2>&1 | grep 'default abi'`
|
||||
case $abi in
|
||||
*-n32)
|
||||
swpaths="/afs/ncsa/packages/hdf/IRIX64-n32_6.5"
|
||||
;;
|
||||
*-64)
|
||||
swpaths="/afs/ncsa/packages/hdf/IRIX64_6.5"
|
||||
;;
|
||||
*)
|
||||
swpaths="/afs/ncsa/packages/hdf/IRIX64_6.5"
|
||||
;;
|
||||
esac # $abi
|
||||
;;
|
||||
*-n32)
|
||||
swpaths="/afs/ncsa/packages/hdf/IRIX64-n32_6.5"
|
||||
;;
|
||||
*)
|
||||
swpaths="/afs/ncsa/packages/hdf/IRIX64_6.5"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Linux)
|
||||
swpaths="/afs/ncsa/packages/hdf/Linux"
|
||||
;;
|
||||
@@ -150,36 +123,6 @@ case "$OSname" in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
IRIX)
|
||||
swpaths="/afs/ncsa/packages/hdf5/IRIX_6.5"
|
||||
;;
|
||||
IRIX64)
|
||||
case "$CC" in
|
||||
cc|"") #default cc
|
||||
abi=`cc -show_defaults 2>&1 | grep 'default abi'`
|
||||
case $abi in
|
||||
*-n32)
|
||||
swpaths="/afs/ncsa/packages/hdf5/IRIX64-n32_6.5"
|
||||
;;
|
||||
*-64)
|
||||
#swpaths="/afs/ncsa/packages/hdf5/IRIX64_6.5"
|
||||
swpaths="/afs/ncsa/packages/hdf5/5-1.4.3-irix64"
|
||||
;;
|
||||
*)
|
||||
#swpaths="/afs/ncsa/packages/hdf5/IRIX64_6.5"
|
||||
swpaths="/afs/ncsa/packages/hdf5/5-1.4.3-irix64"
|
||||
;;
|
||||
esac # $abi
|
||||
;;
|
||||
*-n32)
|
||||
swpaths="/afs/ncsa/packages/hdf5/IRIX64-n32_6.5"
|
||||
;;
|
||||
*)
|
||||
#swpaths="/afs/ncsa/packages/hdf5/IRIX64_6.5"
|
||||
swpaths="/afs/ncsa/packages/hdf5/5-1.4.3-irix64"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Linux)
|
||||
swpaths="/afs/ncsa/packages/hdf5/Linux"
|
||||
;;
|
||||
|
||||
4037
bin/ltmain.sh
4037
bin/ltmain.sh
File diff suppressed because it is too large
Load Diff
219
bin/make_overflow
Executable file
219
bin/make_overflow
Executable file
@@ -0,0 +1,219 @@
|
||||
#!/usr/bin/perl -w
|
||||
require 5.003;
|
||||
use strict;
|
||||
|
||||
# Global settings
|
||||
|
||||
# List of supported C types to generate overflow assignment code for
|
||||
my @ctypes = ( () );
|
||||
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Create assignment overflow #ifdefs
|
||||
#
|
||||
# Programmer: Quincey Koziol
|
||||
# Creation Date: 2009/04/09
|
||||
|
||||
##############################################################################
|
||||
# Parse a meaningful line (not a comment or blank line) into the appropriate
|
||||
# data structure
|
||||
#
|
||||
sub parse_line ($) {
|
||||
my $line = shift; # Get the line to parse
|
||||
|
||||
# Parse get the type name and whether it's signed or unsigned
|
||||
#print "line=$line\n";
|
||||
if($line =~ /.*SIGNED\s*;\s*$/ || $line =~ /.*UNSIGNED\s*;\s*$/) {
|
||||
my $name; # The name of the type
|
||||
my $signed; # Whether the type is signed or not
|
||||
|
||||
# Get the type's name & signed status
|
||||
($name, $signed) = ($line =~ /^\s*(\w*)\s*,\s*(\w*)\s*;\s*$/);
|
||||
#print "name = '$name', signed = '$signed'\n";
|
||||
|
||||
# Append the type to the list of C types already parsed
|
||||
push @ctypes, [$name, $signed];
|
||||
|
||||
}
|
||||
# Unknown keyword
|
||||
else {
|
||||
die "unknown keyword: $line";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Print the copyright into an open file
|
||||
#
|
||||
sub print_copyright ($) {
|
||||
my $fh = shift;
|
||||
|
||||
print $fh "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n";
|
||||
print $fh " * Copyright by The HDF Group. *\n";
|
||||
print $fh " * Copyright by the Board of Trustees of the University of Illinois. *\n";
|
||||
print $fh " * All rights reserved. *\n";
|
||||
print $fh " * *\n";
|
||||
print $fh " * This file is part of HDF5. The full HDF5 copyright notice, including *\n";
|
||||
print $fh " * terms governing use, modification, and redistribution, is contained in *\n";
|
||||
print $fh " * the files COPYING and Copyright.html. COPYING can be found at the root *\n";
|
||||
print $fh " * of the source code distribution tree; Copyright.html can be found at the *\n";
|
||||
print $fh " * root level of an installed copy of the electronic HDF5 document set and *\n";
|
||||
print $fh " * is linked from the top-level documents page. It can also be found at *\n";
|
||||
print $fh " * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *\n";
|
||||
print $fh " * access to either file, you may request a copy from help\@hdfgroup.org. *\n";
|
||||
print $fh " * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Print the "do not change this file" warning
|
||||
#
|
||||
sub print_warning ($) {
|
||||
my $fh = shift;
|
||||
|
||||
print $fh "\n/* Generated automatically by bin/make_overflow -- do not edit */\n";
|
||||
print $fh "/* Add new types to H5overflow.txt file */\n\n";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Print start of ifdef's to prevent a file from being re-included
|
||||
#
|
||||
sub print_startprotect ($$) {
|
||||
my ($fh, $file) = @_;
|
||||
|
||||
# Clip off the ".h" part of the name
|
||||
$file =~ s/(\w*)\.h/$1/;
|
||||
|
||||
# Print the ifdef info
|
||||
print $fh "\n#ifndef _${file}_H\n";
|
||||
print $fh "#define _${file}_H\n";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Print assignment overflow macros for each type
|
||||
#
|
||||
sub print_typemacros ($) {
|
||||
my $fh = shift; # File handle for output file
|
||||
my ($src_aref, $dst_aref); # References for each type's information
|
||||
|
||||
# Print the descriptive comment
|
||||
print $fh "\n\n/* Each type in this file is tested for assignment to the other types,\n";
|
||||
print $fh " * and range checks are defined for bad assignments at run-time.\n";
|
||||
print $fh " */\n";
|
||||
|
||||
for $src_aref (@ctypes) {
|
||||
# Print a descriptive comment
|
||||
print $fh "\n/* Assignment checks for @$src_aref[0] */\n\n";
|
||||
|
||||
for $dst_aref (@ctypes) {
|
||||
if (@$src_aref[0] ne @$dst_aref[0]) {
|
||||
# Print a descriptive comment
|
||||
print $fh "/* src: @$src_aref[0], dst: @$dst_aref[0] */\n";
|
||||
|
||||
# Print actual type size checks & macro definitions
|
||||
print $fh "#if H5_SIZEOF_", uc @$src_aref[0], " < H5_SIZEOF_", uc @$dst_aref[0], "\n";
|
||||
print $fh " #define ASSIGN_", @$src_aref[0], "_TO_", @$dst_aref[0], "(dst, dsttype, src, srctype) \\\n";
|
||||
if ( @$src_aref[1] eq @$dst_aref[1]) {
|
||||
print $fh " ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)\n";
|
||||
} elsif ( @$src_aref[1] eq "SIGNED") {
|
||||
print $fh " ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)\n";
|
||||
} else {
|
||||
print $fh " ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)\n";
|
||||
}
|
||||
print $fh "#elif H5_SIZEOF_", uc @$src_aref[0], " > H5_SIZEOF_", uc @$dst_aref[0], "\n";
|
||||
print $fh " #define ASSIGN_", @$src_aref[0], "_TO_", @$dst_aref[0], "(dst, dsttype, src, srctype) \\\n";
|
||||
print $fh " ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype)\n";
|
||||
print $fh "#else /* H5_SIZEOF_", uc @$src_aref[0], " == H5_SIZEOF_", uc @$dst_aref[0], " */\n";
|
||||
print $fh " #define ASSIGN_", @$src_aref[0], "_TO_", @$dst_aref[0], "(dst, dsttype, src, srctype) \\\n";
|
||||
if ( @$src_aref[1] eq @$dst_aref[1]) {
|
||||
print $fh " ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype)\n";
|
||||
} elsif ( @$src_aref[1] eq "SIGNED") {
|
||||
print $fh " ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype)\n";
|
||||
} else {
|
||||
print $fh " ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype)\n";
|
||||
}
|
||||
print $fh "#endif /* src: @$src_aref[0] dst: @$dst_aref[0] */\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Print end of ifdef's to prevent a file from being re-included
|
||||
#
|
||||
sub print_endprotect ($$) {
|
||||
my ($fh, $file) = @_;
|
||||
|
||||
# Clip off the ".h" part of the name
|
||||
$file =~ s/(\w*)\.h/$1/;
|
||||
|
||||
# Print the endif info
|
||||
print $fh "#endif /* ${file}_H */\n\n";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Create the generated portion of the public header file
|
||||
#
|
||||
sub create_public ($) {
|
||||
my $prefix = shift; # Get the prefix for the generated file
|
||||
my $file = "H5overflow.h"; # Name of file to generate
|
||||
my $name; # Name of function
|
||||
|
||||
# Rename previous file
|
||||
# rename "${prefix}${file}", "${prefix}${file}~" or die "unable to make backup";
|
||||
|
||||
# Open new header file
|
||||
open HEADER, ">${prefix}${file}" or die "unable to modify source";
|
||||
|
||||
# Create file contents
|
||||
print_copyright(*HEADER);
|
||||
print_warning(*HEADER);
|
||||
print_startprotect(*HEADER, $file);
|
||||
print_typemacros(*HEADER);
|
||||
print_endprotect(*HEADER, $file);
|
||||
|
||||
# Close header file
|
||||
close HEADER;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Read symbol version file (given as command-line argument) in and process it
|
||||
# into internal data structures, then create header files.
|
||||
#
|
||||
my $file; # Filename of input file
|
||||
|
||||
for $file (@ARGV) {
|
||||
my $prefix; # Local prefix for generated files
|
||||
my $line; # Line from input file
|
||||
|
||||
#print "file = '$file'\n";
|
||||
($prefix) = ($file =~ /(^.*\/)/);
|
||||
#print "prefix = '$prefix'\n";
|
||||
# Read in the entire file
|
||||
open SOURCE, $file or die "$file: $!\n";
|
||||
while ( defined ($line=<SOURCE>) ) {
|
||||
# Skip blank lines and those lines whose first character is a '#'
|
||||
if(!($line =~ /(^\s*#.*$)|(^\s*$)/)) {
|
||||
# Construct data structures for later printing
|
||||
parse_line($line);
|
||||
}
|
||||
}
|
||||
close SOURCE;
|
||||
|
||||
# Create header files
|
||||
print "Generating 'H5overflow.h'\n";
|
||||
create_public($prefix);
|
||||
}
|
||||
|
||||
111
bin/make_vers
111
bin/make_vers
@@ -2,13 +2,20 @@
|
||||
require 5.003;
|
||||
|
||||
# Global settings
|
||||
# (The max_idx parameter is the only thing that needs to be changed when adding
|
||||
# support for a new major release. If support for a prior major release
|
||||
# is added (like support for 1.4, etc), the min_sup_idx parameter will
|
||||
# need to be decremented. - QAK)
|
||||
|
||||
# Max. library "index" (0 = v1.0, 1 = 1.2, etc)
|
||||
$max_idx = 4;
|
||||
$max_idx = 5;
|
||||
|
||||
# Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc)
|
||||
$min_sup_idx = 3;
|
||||
|
||||
# Number of spaces to indent preprocessor commands inside ifdefs
|
||||
$indent = 2;
|
||||
|
||||
#
|
||||
# Copyright by The HDF Group.
|
||||
# Copyright by the Board of Trustees of the University of Illinois.
|
||||
@@ -82,13 +89,34 @@ sub print_startprotect ($$) {
|
||||
# Print check for conflicting version macro settings
|
||||
#
|
||||
sub print_checkoptions ($) {
|
||||
my $fh = shift;
|
||||
my $fh = shift; # File handle for output file
|
||||
my $curr_idx; # Current API version index
|
||||
|
||||
# Print the option checking
|
||||
print $fh "\n/* Issue error if contradicting macros have been defined. */\n";
|
||||
print $fh "#if defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS)\n";
|
||||
print $fh "#error \"Can't choose old API versions when deprecated APIs are disabled\"\n";
|
||||
print $fh "#endif /* defined(H5_USE_16_API) && defined(H5_NO_DEPRECATED_SYMBOLS) */\n";
|
||||
|
||||
# Print the #ifdef
|
||||
print $fh "#if (";
|
||||
for $curr_idx ($min_sup_idx .. ($max_idx - 1)) {
|
||||
print $fh "defined(H5_USE_1", ($curr_idx * 2), "_API)";
|
||||
if($curr_idx < ($max_idx - 1)) {
|
||||
print $fh " || ";
|
||||
}
|
||||
}
|
||||
print $fh ") && defined(H5_NO_DEPRECATED_SYMBOLS)\n";
|
||||
|
||||
# Print the error for bad API version chosen
|
||||
print $fh ' ' x $indent, "#error \"Can't choose old API versions when deprecated APIs are disabled\"\n";
|
||||
|
||||
# Print the #endif
|
||||
print $fh "#endif /* (";
|
||||
for $curr_idx ($min_sup_idx .. ($max_idx - 1)) {
|
||||
print $fh "defined(H5_USE_1", ($curr_idx * 2), "_API)";
|
||||
if($curr_idx < ($max_idx - 1)) {
|
||||
print $fh " || ";
|
||||
}
|
||||
}
|
||||
print $fh ") && defined(H5_NO_DEPRECATED_SYMBOLS) */\n";
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
@@ -110,7 +138,7 @@ sub print_globalapivers ($) {
|
||||
# Print API version ifdef
|
||||
print $fh "#if defined(H5_USE_1", ($curr_idx * 2), "_API_DEFAULT) && !defined(H5_USE_1", ($curr_idx * 2), "_API)\n";
|
||||
# Print API version definition
|
||||
print $fh "#define H5_USE_1", ($curr_idx * 2), "_API 1\n";
|
||||
print $fh " " x $indent, "#define H5_USE_1", ($curr_idx * 2), "_API 1\n";
|
||||
# Print API version endif
|
||||
print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API_DEFAULT && !H5_USE_1", ($curr_idx * 2), "_API */\n\n";
|
||||
}
|
||||
@@ -118,7 +146,7 @@ sub print_globalapivers ($) {
|
||||
# Loop over supported older library APIs and define the appropriate macros
|
||||
for $curr_idx ($min_sup_idx .. ($max_idx - 1)) {
|
||||
# Print API version ifdef
|
||||
print $fh "#ifdef H5_USE_1", ($curr_idx * 2), "_API\n";
|
||||
print $fh "\n#ifdef H5_USE_1", ($curr_idx * 2), "_API\n";
|
||||
|
||||
# Print the version macro info for each function that is defined for
|
||||
# this API version
|
||||
@@ -127,7 +155,7 @@ sub print_globalapivers ($) {
|
||||
print $fh "/*************/\n";
|
||||
for $name (sort keys %{$func_vers[$curr_idx]}) {
|
||||
print $fh "\n#if !defined(", $name, "_vers)\n";
|
||||
print $fh "#define ", $name, "_vers $func_vers[$curr_idx]{$name}\n";
|
||||
print $fh " " x $indent, "#define ", $name, "_vers $func_vers[$curr_idx]{$name}\n";
|
||||
print $fh "#endif /* !defined(", $name, "_vers) */\n";
|
||||
}
|
||||
|
||||
@@ -138,7 +166,7 @@ sub print_globalapivers ($) {
|
||||
print $fh "/************/\n";
|
||||
for $name (sort keys %{$type_vers[$curr_idx]}) {
|
||||
print $fh "\n#if !defined(", $name, "_t_vers)\n";
|
||||
print $fh "#define ", $name, "_t_vers $type_vers[$curr_idx]{$name}\n";
|
||||
print $fh " " x $indent, "#define ", $name, "_t_vers $type_vers[$curr_idx]{$name}\n";
|
||||
print $fh "#endif /* !defined(", $name, "_t_vers) */\n";
|
||||
}
|
||||
|
||||
@@ -180,25 +208,25 @@ sub print_defaultapivers ($) {
|
||||
|
||||
# Set up default/latest version name mapping
|
||||
print $fh "\n#if !defined($curr_vers_name) || $curr_vers_name == $curr_vers\n";
|
||||
print $fh "#ifndef $curr_vers_name\n";
|
||||
print $fh "#define $curr_vers_name $curr_vers\n";
|
||||
print $fh "#endif /* $curr_vers_name */\n";
|
||||
print $fh "#define $curr_name $curr_name$curr_vers\n";
|
||||
print $fh " " x $indent, "#ifndef $curr_vers_name\n";
|
||||
print $fh " " x ($indent * 2), "#define $curr_vers_name $curr_vers\n";
|
||||
print $fh " " x $indent, "#endif /* $curr_vers_name */\n";
|
||||
print $fh " " x $indent, "#define $curr_name $curr_name$curr_vers\n";
|
||||
|
||||
# Print function's dependent parameter types
|
||||
foreach(sort(@param_list)) {
|
||||
print $fh "#define ${_}_t $_${curr_vers}_t\n";
|
||||
print $fh " " x $indent, "#define ${_}_t $_${curr_vers}_t\n";
|
||||
}
|
||||
|
||||
# Loop to print earlier version name mappings
|
||||
$curr_vers--;
|
||||
while($curr_vers > 0) {
|
||||
print $fh "#elif $curr_vers_name == $curr_vers\n";
|
||||
print $fh "#define $curr_name $curr_name$curr_vers\n";
|
||||
print $fh " " x $indent, "#define $curr_name $curr_name$curr_vers\n";
|
||||
|
||||
# Print function's dependent parameter types
|
||||
foreach(sort(@param_list)) {
|
||||
print $fh "#define ${_}_t $_${curr_vers}_t\n";
|
||||
print $fh " " x $indent, "#define ${_}_t $_${curr_vers}_t\n";
|
||||
}
|
||||
|
||||
$curr_vers--;
|
||||
@@ -206,7 +234,7 @@ sub print_defaultapivers ($) {
|
||||
|
||||
# Finish up with error for unknown version and endif
|
||||
print $fh "#else /* $curr_vers_name */\n";
|
||||
print $fh "#error \"$curr_vers_name set to invalid value\"\n";
|
||||
print $fh " " x $indent, "#error \"$curr_vers_name set to invalid value\"\n";
|
||||
print $fh "#endif /* $curr_vers_name */\n";
|
||||
}
|
||||
|
||||
@@ -224,22 +252,22 @@ sub print_defaultapivers ($) {
|
||||
|
||||
# Set up default/latest version name mapping
|
||||
print $fh "\n#if !defined($curr_vers_name) || $curr_vers_name == $curr_vers\n";
|
||||
print $fh "#ifndef $curr_vers_name\n";
|
||||
print $fh "#define $curr_vers_name $curr_vers\n";
|
||||
print $fh "#endif /* $curr_vers_name */\n";
|
||||
print $fh "#define ${curr_name}_t $curr_name${curr_vers}_t\n";
|
||||
print $fh " " x $indent, "#ifndef $curr_vers_name\n";
|
||||
print $fh " " x ($indent * 2), "#define $curr_vers_name $curr_vers\n";
|
||||
print $fh " " x $indent, "#endif /* $curr_vers_name */\n";
|
||||
print $fh " " x $indent, "#define ${curr_name}_t $curr_name${curr_vers}_t\n";
|
||||
|
||||
# Loop to print earlier version name mappings
|
||||
$curr_vers--;
|
||||
while($curr_vers > 0) {
|
||||
print $fh "#elif $curr_vers_name == $curr_vers\n";
|
||||
print $fh "#define ${curr_name}_t $curr_name${curr_vers}_t\n";
|
||||
print $fh " " x $indent, "#define ${curr_name}_t $curr_name${curr_vers}_t\n";
|
||||
$curr_vers--;
|
||||
}
|
||||
|
||||
# Finish up with error for unknown version and endif
|
||||
print $fh "#else /* $curr_vers_name */\n";
|
||||
print $fh "#error \"$curr_vers_name set to invalid value\"\n";
|
||||
print $fh " " x $indent, "#error \"$curr_vers_name set to invalid value\"\n";
|
||||
print $fh "#endif /* $curr_vers_name */\n\n";
|
||||
}
|
||||
}
|
||||
@@ -271,6 +299,7 @@ sub parse_line ($) {
|
||||
my $params; # Typedefs for function parameters
|
||||
my $vers; # The version info for the function
|
||||
my @vers_list; # Version info, as a list
|
||||
my @vers_nums; # Version info, as a numeric list
|
||||
my $num_versions; # Number of versions for function
|
||||
my %sym_versions; # Versions for a symbol
|
||||
my $last_idx; # The previous version index seen for a function
|
||||
@@ -308,15 +337,12 @@ sub parse_line ($) {
|
||||
@vers_list = split(/\s*,\s*/, $vers);
|
||||
#print "parse_line: vers_list=(@vers_list)\n";
|
||||
|
||||
# Check for invalid version info given
|
||||
$last_idx = -1;
|
||||
$last_vers = 1;
|
||||
foreach(sort(@vers_list)) {
|
||||
# Parse the version list into numbers, checking for invalid input
|
||||
foreach(@vers_list) {
|
||||
my $vers_idx; # Index of version in array
|
||||
|
||||
#print "parse_line: _=$_ last_idx='$last_idx'\n";
|
||||
# Do some validation on the input
|
||||
if(!($_ =~ /v1[02468]/)) {
|
||||
if(!( $_ =~ /v1[02468]/ || $_ =~ /v11[02468]/ )) {
|
||||
die "bad version information: $name";
|
||||
}
|
||||
if(exists($sym_versions{$_})) {
|
||||
@@ -326,18 +352,29 @@ sub parse_line ($) {
|
||||
# Store the versions for the function in a local hash table, indexed by the version
|
||||
$sym_versions{$_}=$_;
|
||||
|
||||
#print "parse_line: _=$_\n";
|
||||
# Get the index of the version
|
||||
($vers_idx) = ($_ =~ /v1(\d)/);
|
||||
($vers_idx) = ($_ =~ /v1(\d+)/);
|
||||
$vers_idx /= 2;
|
||||
#print "parse_line: vers_idx='$vers_idx'\n";
|
||||
push(@vers_nums, $vers_idx);
|
||||
}
|
||||
#print "parse_line: vers_nums=(@vers_nums)\n";
|
||||
|
||||
# Check for invalid version info given
|
||||
$last_idx = -1;
|
||||
$last_vers = 1;
|
||||
foreach(sort(@vers_nums)) {
|
||||
#print "parse_line: _=$_ last_idx='$last_idx'\n";
|
||||
# Update intermediate versions of the library that included the API routine
|
||||
if($last_idx >= 0) {
|
||||
#print "parse_line: name='$name'\n";
|
||||
#print "parse_line: last_vers='$last_vers'\n";
|
||||
#print "parse_line: last_idx='$last_idx'\n";
|
||||
|
||||
# Add the function to the list of API routines available in
|
||||
# different versions of the library
|
||||
while($last_idx < $vers_idx) {
|
||||
while($last_idx <= $_) {
|
||||
if($line_type == 1) {
|
||||
$func_vers[$last_idx]{$name} = $last_vers;
|
||||
} elsif($line_type == 2) {
|
||||
@@ -353,7 +390,7 @@ sub parse_line ($) {
|
||||
}
|
||||
|
||||
# Keep track of last version index seen
|
||||
$last_idx = $vers_idx;
|
||||
$last_idx = $_;
|
||||
}
|
||||
|
||||
# Finish updating versions of the library that included the API routine
|
||||
@@ -427,7 +464,13 @@ for $file (@ARGV) {
|
||||
my $prefix; # Local prefix for generated files
|
||||
|
||||
#print "file = '$file'\n";
|
||||
($prefix) = ($file =~ /(^.*\/)/);
|
||||
# Check for directory prefix on input file
|
||||
if($file =~ /\//) {
|
||||
($prefix) = ($file =~ /(^.*\/)/);
|
||||
}
|
||||
else {
|
||||
$prefix = "";
|
||||
}
|
||||
#print "prefix = '$prefix'\n";
|
||||
# Read in the entire file
|
||||
open SOURCE, $file or die "$file: $!\n";
|
||||
@@ -441,7 +484,7 @@ for $file (@ARGV) {
|
||||
close SOURCE;
|
||||
|
||||
# Create header files
|
||||
print "Generating 'H5version.h'\n";
|
||||
print "Generating '", $prefix, "H5version.h'\n";
|
||||
create_public($prefix);
|
||||
|
||||
#for $name (sort keys %functions) {
|
||||
|
||||
446
bin/missing
446
bin/missing
@@ -1,11 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2005-02-08.22
|
||||
scriptversion=2013-10-28.13; # UTC
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -18,9 +17,7 @@ scriptversion=2005-02-08.22
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
@@ -28,63 +25,40 @@ scriptversion=2005-02-08.22
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
case $1 in
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
@@ -96,262 +70,146 @@ Send bug reports to <bug-automake@gnu.org>."
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program).
|
||||
case "$1" in
|
||||
lex|yacc)
|
||||
# Not GNU programs, they don't have --version.
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
tar)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
||||
101
bin/output_filter.sh
Normal file
101
bin/output_filter.sh
Normal file
@@ -0,0 +1,101 @@
|
||||
## Copyright by The HDF Group.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This file is part of HDF5. The full HDF5 copyright notice, including
|
||||
## terms governing use, modification, and redistribution, is contained in
|
||||
## the 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.
|
||||
|
||||
# This contains function definitions of output filtering.
|
||||
# This file should only be sourced in by another shell script.
|
||||
#
|
||||
# Programmer: Albert Cheng
|
||||
# Created Date: 2011/5/3
|
||||
|
||||
|
||||
# Some systems will dump some messages to stdout for various reasons.
|
||||
# Remove them from the stdout result file.
|
||||
# $1 is the file name of the file to be filtered.
|
||||
# Cases of filter needed:
|
||||
# 1. Sandia Red-Storm
|
||||
# yod always prints these two lines at the beginning.
|
||||
# LibLustre: NAL NID: 0004a605 (5)
|
||||
# Lustre: OBD class driver Build Version: 1, info@clusterfs.com
|
||||
# 2. LANL Lambda
|
||||
# mpijob mirun -np always add an extra line at the end like:
|
||||
# P4 procgroup file is /users/acheng/.lsbatch/host10524.l82
|
||||
STDOUT_FILTER() {
|
||||
result_file=$1
|
||||
tmp_file=/tmp/h5test_tmp_$$
|
||||
# Filter Sandia Red-Storm yod messages.
|
||||
cp $result_file $tmp_file
|
||||
sed -e '/^LibLustre:/d' -e '/^Lustre:/d' \
|
||||
< $tmp_file > $result_file
|
||||
# Filter LANL Lambda mpirun message.
|
||||
cp $result_file $tmp_file
|
||||
sed -e '/^P4 procgroup file is/d' \
|
||||
< $tmp_file > $result_file
|
||||
# cleanup
|
||||
rm -f $tmp_file
|
||||
}
|
||||
|
||||
|
||||
# Some systems will dump some messages to stderr for various reasons.
|
||||
# Remove them from the stderr result file.
|
||||
# $1 is the file name of the file to be filtered.
|
||||
# Cases of filter needed:
|
||||
# 1. MPE:
|
||||
# In parallel mode and if MPE library is used, it prints the following
|
||||
# two message lines whether the MPE tracing is used or not.
|
||||
# Writing logfile.
|
||||
# Finished writing logfile.
|
||||
# 2. LANL MPI:
|
||||
# The LANL MPI will print some messages like the following,
|
||||
# LA-MPI: *** mpirun (1.5.10)
|
||||
# LA-MPI: *** 3 process(es) on 2 host(s): 2*fln21 1*fln22
|
||||
# LA-MPI: *** libmpi (1.5.10)
|
||||
# LA-MPI: *** Copyright 2001-2004, ACL, Los Alamos National Laboratory
|
||||
# 3. h5diff debug output:
|
||||
# Debug output all have prefix "h5diff debug: ".
|
||||
# 4. AIX system prints messages like these when it is aborting:
|
||||
# ERROR: 0031-300 Forcing all remote tasks to exit due to exit code 1 in task 0
|
||||
# ERROR: 0031-250 task 4: Terminated
|
||||
# ERROR: 0031-250 task 3: Terminated
|
||||
# ERROR: 0031-250 task 2: Terminated
|
||||
# ERROR: 0031-250 task 1: Terminated
|
||||
# 5. LLNL Blue-Gene mpirun prints messages like there when it exit non-zero:
|
||||
# <Apr 12 15:01:49.075658> BE_MPI (ERROR): The error message in the job record is as follows:
|
||||
# <Apr 12 15:01:49.075736> BE_MPI (ERROR): "killed by exit(1) on node 0"
|
||||
STDERR_FILTER() {
|
||||
result_file=$1
|
||||
tmp_file=/tmp/h5test_tmp_$$
|
||||
# Filter LLNL Blue-Gene error messages in both serial and parallel modes
|
||||
# since mpirun is used in both modes.
|
||||
cp $result_file $tmp_file
|
||||
sed -e '/ BE_MPI (ERROR): /d' \
|
||||
< $tmp_file > $result_file
|
||||
# Filter MPE messages
|
||||
if test -n "$pmode"; then
|
||||
cp $result_file $tmp_file
|
||||
sed -e '/^Writing logfile./d' -e '/^Finished writing logfile./d' \
|
||||
< $tmp_file > $result_file
|
||||
fi
|
||||
# Filter LANL MPI messages
|
||||
# and LLNL srun messages
|
||||
# and AIX error messages
|
||||
if test -n "$pmode"; then
|
||||
cp $result_file $tmp_file
|
||||
sed -e '/^LA-MPI:/d' -e '/^srun:/d' -e '/^ERROR:/d' \
|
||||
< $tmp_file > $result_file
|
||||
fi
|
||||
# Filter h5diff debug output
|
||||
cp $result_file $tmp_file
|
||||
sed -e '/^h5diff debug: /d' \
|
||||
< $tmp_file > $result_file
|
||||
# clean up temporary files.
|
||||
rm -f $tmp_file
|
||||
}
|
||||
@@ -28,32 +28,40 @@
|
||||
# of versions that can get confused (not even counting the m4 utility)!
|
||||
|
||||
# HDF5 currently uses the following versions of the autotools:
|
||||
AUTOCONF_VERSION="autoconf (GNU Autoconf) 2.61"
|
||||
AUTOMAKE_VERSION="automake (GNU automake) 1.10.1"
|
||||
AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.61"
|
||||
ACLOCAL_VERSION="aclocal (GNU automake) 1.10.1"
|
||||
LIBTOOL_VERSION="(GNU libtool) 2.2.6"
|
||||
AUTOCONF_VERSION="autoconf (GNU Autoconf) 2.69"
|
||||
AUTOMAKE_VERSION="automake (GNU automake) 1.14.1"
|
||||
AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.69"
|
||||
ACLOCAL_VERSION="aclocal (GNU automake) 1.14.1"
|
||||
LIBTOOL_VERSION="(GNU libtool) 2.4.2"
|
||||
M4_VERSION="m4 (GNU M4) 1.4.17"
|
||||
|
||||
#
|
||||
# When upgrading automake's version, don't forget to also update its
|
||||
# helper utilities, especially depcomp.
|
||||
|
||||
|
||||
# If paths to autotools are not specified by the user, assume tools are
|
||||
# running on kagiso and set paths accordingly.
|
||||
# running on jam in /mnt/hdf/packages and set paths accordingly.
|
||||
if test -z ${AUTORECONF}; then
|
||||
AUTORECONF=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoreconf
|
||||
fi
|
||||
if test -z ${AUTOCONF}; then
|
||||
AUTOCONF=/mnt/hdf/packages/autoconf/autoconf-2.61/bin/autoconf
|
||||
AUTOCONF=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoconf
|
||||
fi
|
||||
if test -z ${AUTOMAKE}; then
|
||||
AUTOMAKE=/mnt/hdf/packages/automake/automake-1.10.1/bin/automake-1.10
|
||||
AUTOMAKE=/mnt/hdf/packages/automake/automake-1.14.1/bin/automake-1.14
|
||||
fi
|
||||
if test -z ${AUTOHEADER}; then
|
||||
AUTOHEADER=/mnt/hdf/packages/autoconf/autoconf-2.61/bin/autoheader
|
||||
AUTOHEADER=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoheader
|
||||
fi
|
||||
if test -z ${ACLOCAL}; then
|
||||
ACLOCAL=/mnt/hdf/packages/automake/automake-1.10.1/bin/aclocal-1.10
|
||||
ACLOCAL=/mnt/hdf/packages/automake/automake-1.14.1/bin/aclocal-1.14
|
||||
fi
|
||||
if test -z ${LIBTOOL}; then
|
||||
LIBTOOL=/mnt/hdf/packages/libtool/libtool-2.2.6a/bin/libtool
|
||||
LIBTOOL=/mnt/hdf/packages/libtool/libtool-2.4.2/bin/libtool
|
||||
fi
|
||||
if test -z ${M4}; then
|
||||
M4=/mnt/hdf/packages/m4/m4-1.4.17/bin/m4
|
||||
fi
|
||||
|
||||
# Check version numbers of all autotools against the "correct" versions
|
||||
@@ -82,14 +90,17 @@ if test -z "${LT_VERS}"; then
|
||||
echo "${LIBTOOL} version is not ${LIBTOOL_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use the latest version of M4
|
||||
PATH=/mnt/hdf/packages/m4/m4-1.4.7/bin:/mnt/hdf/packages/m4/m4-1.4.7/share:$PATH
|
||||
M4_VERS=`${M4} --version 2>&1 | grep "${M4_VERSION}"`
|
||||
if test -z "${M4_VERS}"; then
|
||||
echo "${M4} version is not ${M4_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure that the tools are in the path.
|
||||
AUTOCONF_DIR=`dirname ${AUTOCONF}`
|
||||
LIBTOOL_DIR=`dirname ${LIBTOOL}`
|
||||
PATH=${AUTOCONF_DIR}:$PATH
|
||||
M4_DIR=`dirname ${M4}`
|
||||
PATH=${AUTOCONF_DIR}:${M4_DIR}:$PATH
|
||||
|
||||
# Run autoconf/automake commands in order
|
||||
echo ${ACLOCAL} -I ${LIBTOOL_DIR}/../share/aclocal
|
||||
@@ -132,4 +143,10 @@ echo
|
||||
echo " Running API version generation script:"
|
||||
bin/make_vers src/H5vers.txt || exit 1
|
||||
|
||||
# Run flex
|
||||
# automatically generates the lexical file for hl/src/H5LTanalyze.c
|
||||
echo
|
||||
echo " Running flex generation script:"
|
||||
bin/genltanalyze || exit 1
|
||||
|
||||
exit 0
|
||||
|
||||
189
bin/release
189
bin/release
@@ -14,42 +14,10 @@
|
||||
# access to either file, you may request a copy from help@hdfgroup.org.
|
||||
#
|
||||
|
||||
# Make a release of hdf5. The command-line switches are:
|
||||
# Make a release of hdf5.
|
||||
#
|
||||
# -d DIR The name of the directory where the releas(es) should be
|
||||
# placed. By default, the directory is ./releases
|
||||
#
|
||||
# --nocheck Ignore errors in MANIFEST file.
|
||||
#
|
||||
# --private Make a private release with today's date in version information.
|
||||
#
|
||||
# The other command-line options are the names of the programs to use
|
||||
# for compressing the resulting tar archive (if none are given then
|
||||
# `tar md5' is assumed):
|
||||
#
|
||||
# tar -- use tar and don't do any compressing.
|
||||
# compress -- use compress and append `.Z' to the output name.
|
||||
# gzip -- use gzip with `-9' and append `.gz' to the output name.
|
||||
# bzip2 -- use bzip2 with `-9' and append `.bz2' to the output name.
|
||||
# md5 -- produce a md5 checksum in addition to the archive.
|
||||
# doc -- produce the latest doc tree in addition to the archive.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# $ release
|
||||
# releases/hdf5-1.0.38.tar
|
||||
# releases/hdf5-1.0.38.tar.md5
|
||||
#
|
||||
# $ release gzip
|
||||
# releases/hdf5-1.0.38.tar.gz
|
||||
#
|
||||
# $ release -d /tmp tar compress gzip bzip2 md5 doc
|
||||
# /tmp/hdf5-1.0.38.tar
|
||||
# /tmp/hdf5-1.0.38.tar.Z
|
||||
# /tmp/hdf5-1.0.38.tar.gz
|
||||
# /tmp/hdf5-1.0.38.tar.bz2
|
||||
# /tmp/hdf5-1.0.38.tar.md5
|
||||
# /tmp/hdf5-1.0.38_doc.tar
|
||||
# Programmer: Robb Matzke
|
||||
# Creation date: on or before 1998-01-29.
|
||||
#
|
||||
# Modifications
|
||||
# Robb Matzke, 1999-07-16
|
||||
@@ -59,6 +27,12 @@
|
||||
# Albert Cheng, 1999-10-26
|
||||
# Moved the MANIFEST checking to a separate command file so that
|
||||
# it can be invoked individually.
|
||||
#
|
||||
# Albert Cheng, 2004-08-14
|
||||
# Added the --private option.
|
||||
#
|
||||
# James Laird, 2005-09-07
|
||||
# Added the md5 method.
|
||||
|
||||
# Function definitions
|
||||
#
|
||||
@@ -66,45 +40,116 @@
|
||||
USAGE()
|
||||
{
|
||||
cat << EOF
|
||||
Usage: $0 [--nocheck] [-d <dir>] [-h] <methods> ...
|
||||
Usage: $0 -d <dir> [-h] [--nocheck] [--private] <methods> ...
|
||||
-d DIR The name of the directory where the releas(es) should be
|
||||
placed. By default, the directory is ./releases
|
||||
|
||||
placed.
|
||||
-h print the help page.
|
||||
--nocheck Ignore errors in MANIFEST file.
|
||||
|
||||
--private Make a private release with today's date in version information.
|
||||
|
||||
This must be run at the top level of the source directory.
|
||||
The other command-line options are the names of the programs to use
|
||||
for compressing the resulting tar archive (if none are given then
|
||||
"tar md5" is assumed):
|
||||
"tar" is assumed):
|
||||
|
||||
tar -- use tar and don't do any compressing.
|
||||
compress -- use compress and append ".Z" to the output name.
|
||||
gzip -- use gzip with "-9" and append ".gz" to the output name.
|
||||
bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name.
|
||||
md5 -- produce a md5 checksum in addition to the archive.
|
||||
zip -- convert all text files to DOS style and form a zip file for Windows use.
|
||||
doc -- produce the latest doc tree in addition to the archive.
|
||||
|
||||
An md5 checksum is produced for each archive created and stored in the md5 file.
|
||||
|
||||
Examples:
|
||||
|
||||
$ release
|
||||
releases/hdf5-1.0.38.tar
|
||||
releases/hdf5-1.0.38.tar.md5
|
||||
$ bin/release -d /tmp
|
||||
/tmp/hdf5-1.8.13-RELEASE.txt
|
||||
/tmp/hdf5-1.8.13.md5
|
||||
/tmp/hdf5-1.8.13.tar
|
||||
|
||||
$ release gzip
|
||||
releases/hdf5-1.0.38.tar.gz
|
||||
$ bin/release -d /tmp gzip
|
||||
/tmp/hdf5-1.8.13-RELEASE.txt
|
||||
/tmp/hdf5-1.8.13.md5
|
||||
/tmp/hdf5-1.8.13.tar.gz
|
||||
|
||||
$ release -d /tmp tar compress gzip bzip2 md5
|
||||
/tmp/hdf5-1.0.38.tar
|
||||
/tmp/hdf5-1.0.38.tar.Z
|
||||
/tmp/hdf5-1.0.38.tar.gz
|
||||
/tmp/hdf5-1.0.38.tar.bz2
|
||||
/tmp/hdf5-1.0.38.tar.md5
|
||||
$ bin/release -d /tmp tar gzip zip
|
||||
/tmp/hdf5-1.8.13-RELEASE.txt
|
||||
/tmp/hdf5-1.8.13.md5
|
||||
/tmp/hdf5-1.8.13.tar
|
||||
/tmp/hdf5-1.8.13.tar.gz
|
||||
/tmp/hdf5-1.8.13.tar.zip
|
||||
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
# Function name: tar2zip
|
||||
# Convert the release tarball to a Windows zipball.
|
||||
#
|
||||
# Programmer: Albert Cheng
|
||||
# Creation date: 2014-04-23
|
||||
#
|
||||
# Modifications
|
||||
#
|
||||
# Steps:
|
||||
# 1. untar the tarball in a temporay directory;
|
||||
# Note: do this in a temporary directory to avoid changing
|
||||
# the original source directory which maybe around.
|
||||
# 2. convert all its text files to DOS (LF-CR) style;
|
||||
# 3. form a zip file which is usable by Windows users.
|
||||
#
|
||||
# Parameters:
|
||||
# $1 version
|
||||
# $2 release tarball
|
||||
# $3 output zipball file name
|
||||
#
|
||||
# Returns 0 if successful; 1 otherwise
|
||||
#
|
||||
tar2zip()
|
||||
{
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "usage: tar2zip <tarfilename> <zipfilename>"
|
||||
return 1
|
||||
fi
|
||||
ztmpdir=/tmp/tmpdir$$
|
||||
mkdir -p $ztmpdir
|
||||
version=$1
|
||||
tarfile=$2
|
||||
zipfile=$3
|
||||
|
||||
# step 1: untar tarball in ztmpdir
|
||||
(cd $ztmpdir; tar xf -) < $tarfile
|
||||
# sanity check
|
||||
if [ ! -d $ztmpdir/$version ]; then
|
||||
echo "untar did not create $ztmpdir/$version source dir"
|
||||
# cleanup
|
||||
rm -rf $ztmpdir
|
||||
return 1
|
||||
fi
|
||||
# step 2: convert text files
|
||||
# There maybe a simpler way to do this.
|
||||
# options used in unix2dos:
|
||||
# -k Keep the date stamp
|
||||
# -q quiet mode
|
||||
# grep redirect output to /dev/null because -q or -s are not portable.
|
||||
find $ztmpdir/$version | \
|
||||
while read inf; do \
|
||||
if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \
|
||||
unix2dos -q -k $inf; \
|
||||
fi\
|
||||
done
|
||||
# step 3: make zipball
|
||||
# -9 maximum compression
|
||||
# -y Store symbolic links as such in the zip archive
|
||||
# -r recursive
|
||||
# -q quiet
|
||||
(cd $ztmpdir; zip -9 -y -r -q $version.zip $version)
|
||||
mv $ztmpdir/$version.zip $zipfile
|
||||
|
||||
# cleanup
|
||||
rm -rf $ztmpdir
|
||||
}
|
||||
|
||||
# This command must be run at the top level of the hdf5 source directory.
|
||||
# Verify this requirement.
|
||||
if [ ! \( -f configure -a -f bin/release \) ]; then
|
||||
@@ -119,6 +164,7 @@ VERS_OLD=
|
||||
test "$VERS" || exit 1
|
||||
verbose=yes
|
||||
check=yes
|
||||
release_date=`date +%F`
|
||||
today=`date +%Y%m%d`
|
||||
pmode='no'
|
||||
tmpdir="../#release_tmp.$$" # tmp work directory
|
||||
@@ -168,9 +214,9 @@ while [ -n "$1" ]; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Default methods are tar and md5
|
||||
# Default method is tar
|
||||
if [ "X$methods" = "X" ]; then
|
||||
methods="tar md5"
|
||||
methods="tar"
|
||||
fi
|
||||
|
||||
# Create the temporay work directory.
|
||||
@@ -222,13 +268,15 @@ grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST
|
||||
|
||||
# Prepare the source tree for a release.
|
||||
ln -s `pwd` $tmpdir/$HDF5_VERS || exit 1
|
||||
mv Makefile $tmpdir/Makefile.x 2>/dev/null #might fail
|
||||
# Save a backup copy of Makefile if exists.
|
||||
test -f Makefile && mv Makefile $tmpdir/Makefile.x
|
||||
cp -p Makefile.dist Makefile
|
||||
|
||||
# Update README.txt and release_docs/RELEASE.txt with release information.
|
||||
# Update README.txt and release_docs/RELEASE.txt with release information in
|
||||
# line 1.
|
||||
for f in README.txt release_docs/RELEASE.txt; do
|
||||
echo "HDF5 version $VERS released on `date`" >$f.x
|
||||
tail +2l $f >>$f.x
|
||||
echo "HDF5 version $VERS released on $release_date" >$f.x
|
||||
sed -e 1d $f >>$f.x
|
||||
mv $f.x $f
|
||||
# Make sure new files are of the right access mode
|
||||
chmod 644 $f
|
||||
@@ -243,26 +291,28 @@ test "$verbose" && echo " Running tar..." 1>&2
|
||||
)
|
||||
|
||||
# Compress
|
||||
MD5file=$HDF5_VERS.md5
|
||||
cp /dev/null $DEST/$MD5file
|
||||
for comp in $methods; do
|
||||
case $comp in
|
||||
tar)
|
||||
cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar
|
||||
;;
|
||||
compress)
|
||||
test "$verbose" && echo " Running compress..." 1>&2
|
||||
compress -c <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.Z
|
||||
(cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file)
|
||||
;;
|
||||
gzip)
|
||||
test "$verbose" && echo " Running gzip..." 1>&2
|
||||
gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz
|
||||
(cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file)
|
||||
;;
|
||||
bzip2)
|
||||
test "$verbose" && echo " Running bzip2..." 1>&2
|
||||
bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2
|
||||
(cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file)
|
||||
;;
|
||||
md5)
|
||||
test "$verbose" && echo " Creating checksum..." 1>&2
|
||||
(cd $tmpdir; md5sum $HDF5_VERS.tar ) > $DEST/$HDF5_VERS.tar.md5
|
||||
zip)
|
||||
test "$verbose" && echo " Creating zip ball..." 1>&2
|
||||
tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2
|
||||
(cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file)
|
||||
;;
|
||||
doc)
|
||||
test "$verbose" && echo " Creating docs..." 1>&2
|
||||
@@ -278,13 +328,18 @@ for comp in $methods; do
|
||||
(cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs)
|
||||
mv $tmpdir/${HDF5_VERS}_docs.tar $DEST
|
||||
;;
|
||||
*)
|
||||
echo "***Error*** Unknown method $comp"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Copy the RELEASE.txt to the release area.
|
||||
cp release_docs/RELEASE.txt $DEST/$HDF5_VERS-RELEASE.txt
|
||||
|
||||
# Restore previous Makefile if existed.
|
||||
# Remove distributed Makefile and restore previous Makefile if existed.
|
||||
rm -f Makefile
|
||||
test -f $tmpdir/Makefile.x && mv $tmpdir/Makefile.x Makefile
|
||||
|
||||
# Restore OLD version information, then no need for trap.
|
||||
|
||||
18
bin/snapshot
18
bin/snapshot
@@ -67,8 +67,8 @@ ReleaseDir_default=release_dir
|
||||
ZLIB_default=
|
||||
ZLIB=$ZLIB_default
|
||||
|
||||
# What compression methods to use? (md5 does checksum).
|
||||
METHODS="gzip bzip2 md5 doc"
|
||||
# What compression methods to use?
|
||||
METHODS="gzip zip bzip2 doc"
|
||||
|
||||
# Use User's MAKE if set. Else use generic make.
|
||||
MAKE=${MAKE:-make}
|
||||
@@ -199,6 +199,9 @@ while [ $# -gt 0 ] ; do
|
||||
check-vfd)
|
||||
CHECKVAL=check-vfd
|
||||
;;
|
||||
yodconfigure)
|
||||
YODCONFIGURE=yes
|
||||
;;
|
||||
--*)
|
||||
OP_CONFIGURE="$OP_CONFIGURE $1"
|
||||
;;
|
||||
@@ -284,7 +287,14 @@ fi
|
||||
# Setup the proper configure option (--with-zlib) to use zlib library
|
||||
# provide ZLIB is non-empty.
|
||||
ZLIB=${ZLIB:+"--with-zlib="$ZLIB}
|
||||
CONFIGURE="./configure $ZLIB $OP_CONFIGURE"
|
||||
if [ -n "$YODCONFIGURE" ]; then
|
||||
cp configure configure.yod
|
||||
bin/yodconfigure configure.yod
|
||||
CONFIGURE="./configure.yod"
|
||||
else
|
||||
CONFIGURE="./configure"
|
||||
fi
|
||||
CONFIGURE="$CONFIGURE $ZLIB $OP_CONFIGURE"
|
||||
|
||||
# Execute the requests
|
||||
snapshot=yes
|
||||
@@ -412,7 +422,7 @@ if [ "$cmd" = "all" -o -n "$cmdtest" -o -n "$cmddiff" ]; then
|
||||
TIMESTAMP "check-install" && \
|
||||
${MAKE} check-install && DISKUSAGE \
|
||||
TIMESTAMP "uninstall" && \
|
||||
${MAKE} uninstall-all) && DISKUSAGE ; then
|
||||
${MAKE} uninstall-all && DISKUSAGE); then
|
||||
:
|
||||
else
|
||||
errcode=$?
|
||||
|
||||
139
bin/test-driver
Executable file
139
bin/test-driver
Executable file
@@ -0,0 +1,139 @@
|
||||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2013-07-13.22; # UTC
|
||||
|
||||
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
estatus=$?
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
estatus=1
|
||||
fi
|
||||
|
||||
case $estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
47
bin/trace
47
bin/trace
@@ -36,7 +36,10 @@ $Source = "";
|
||||
"H5D_fill_time_t" => "Df",
|
||||
"H5D_fill_value_t" => "DF",
|
||||
"H5FD_mpio_chunk_opt_t" => "Dh",
|
||||
"H5D_mpio_actual_io_mode_t" => "Di",
|
||||
"H5D_layout_t" => "Dl",
|
||||
"H5D_mpio_no_collective_cause_t" => "Dn",
|
||||
"H5D_mpio_actual_chunk_opt_mode_t" => "Do",
|
||||
"H5D_space_status_t" => "Ds",
|
||||
"H5FD_mpio_xfer_t" => "Dt",
|
||||
"herr_t" => "e",
|
||||
@@ -44,6 +47,8 @@ $Source = "";
|
||||
"H5E_error_t" => "Ee",
|
||||
"H5E_type_t" => "Et",
|
||||
"H5F_close_degree_t" => "Fd",
|
||||
"H5F_file_space_type_t" => "Ff",
|
||||
"H5F_mem_t" => "Fm",
|
||||
"H5F_scope_t" => "Fs",
|
||||
"H5F_libver_t" => "Fv",
|
||||
"H5G_obj_t" => "Go",
|
||||
@@ -59,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",
|
||||
@@ -71,6 +77,7 @@ $Source = "";
|
||||
"hobj_ref_t" => "r",
|
||||
"H5R_type_t" => "Rt",
|
||||
"char" => "s",
|
||||
"unsigned char" => "s",
|
||||
"H5S_class_t" => "Sc",
|
||||
"H5S_seloper_t" => "Ss",
|
||||
"H5S_sel_type" => "St",
|
||||
@@ -84,6 +91,8 @@ $Source = "";
|
||||
"H5T_sign_t" => "Ts",
|
||||
"H5T_class_t" => "Tt",
|
||||
"H5T_str_t" => "Tz",
|
||||
"unsigned long" => "Ul",
|
||||
"unsigned long long" => "UL",
|
||||
"void" => "x",
|
||||
"FILE" => "x",
|
||||
"H5A_operator_t" => "x",
|
||||
@@ -91,25 +100,36 @@ $Source = "";
|
||||
"H5A_operator2_t" => "x",
|
||||
"H5A_info_t" => "x",
|
||||
"H5AC_cache_config_t" => "x",
|
||||
"H5D_append_cb_t" => "x",
|
||||
"H5D_gather_func_t" => "x",
|
||||
"H5D_operator_t" => "x",
|
||||
"H5D_scatter_func_t" => "x",
|
||||
"H5E_auto_t" => "x",
|
||||
"H5E_auto1_t" => "x",
|
||||
"H5E_auto2_t" => "x",
|
||||
"H5E_walk_t" => "x",
|
||||
"H5E_walk1_t" => "x",
|
||||
"H5E_walk2_t" => "x",
|
||||
"H5F_info_t" => "x",
|
||||
"H5F_flush_cb_t" => "x",
|
||||
"H5F_info1_t" => "x",
|
||||
"H5F_info2_t" => "x",
|
||||
"H5F_retry_info_t" => "x",
|
||||
"H5FD_t" => "x",
|
||||
"H5FD_class_t" => "x",
|
||||
"H5FD_stream_fapl_t" => "x",
|
||||
"H5FD_file_image_callbacks_t" => "x",
|
||||
"H5G_iterate_t" => "x",
|
||||
"H5G_info_t" => "x",
|
||||
"H5L_class_t" => "x",
|
||||
"H5I_free_t" => "x",
|
||||
"H5I_search_func_t" => "x",
|
||||
"H5L_class_t" => "x",
|
||||
"H5L_elink_traverse_t" => "x",
|
||||
"H5L_iterate_t" => "x",
|
||||
"H5MM_allocate_t" => "x",
|
||||
"H5MM_free_t" => "x",
|
||||
"H5O_info_t" => "x",
|
||||
"H5O_iterate_t" => "x",
|
||||
"H5O_mcdt_search_cb_t" => "x",
|
||||
"H5P_cls_create_func_t" => "x",
|
||||
"H5P_cls_copy_func_t" => "x",
|
||||
"H5P_cls_close_func_t" => "x",
|
||||
@@ -126,6 +146,7 @@ $Source = "";
|
||||
"H5T_conv_except_func_t" => "x",
|
||||
"H5Z_func_t" => "x",
|
||||
"H5Z_filter_func_t" => "x",
|
||||
"va_list" => "x",
|
||||
"size_t" => "z",
|
||||
"H5Z_SO_scale_type_t" => "Za",
|
||||
"H5Z_class_t" => "Zc",
|
||||
@@ -161,7 +182,7 @@ sub argstring ($$$) {
|
||||
# Normalize the data type by removing redundant white space,
|
||||
# certain type qualifiers, and indirection.
|
||||
$atype =~ s/^\bconst\b//;
|
||||
$atype =~ s/\bUNUSED\b//g;
|
||||
$atype =~ s/\bH5_ATTR_UNUSED\b//g;
|
||||
$atype =~ s/\s+/ /g;
|
||||
$ptr = length $1 if $atype =~ s/(\*+)//;
|
||||
$atype =~ s/^\s+//;
|
||||
@@ -212,6 +233,9 @@ sub rewrite_func ($$$$$) {
|
||||
my %names;
|
||||
|
||||
for $arg (@args) {
|
||||
if($arg=~/\w*\.{3}\w*/){
|
||||
next;
|
||||
}
|
||||
unless ($arg=~/^(([a-z_A-Z]\w*\s+)+\**)
|
||||
([a-z_A-Z]\w*)(\[.*?\])?
|
||||
(\s*\/\*\s*(in|out|in_out)\s*\*\/)?\s*$/x) {
|
||||
@@ -261,14 +285,10 @@ sub rewrite_func ($$$$$) {
|
||||
|
||||
# The H5TRACE() statement
|
||||
if ($body =~ /\/\*[ \t]*NO[ \t]*TRACE[ \t]*\*\//) {
|
||||
if ($body =~ /\s*H5TRACE\d+\s*\(/) {
|
||||
errmesg $file, $name, "warning: trace info was not updated because of NO TRACE comment";
|
||||
} else {
|
||||
errmesg $file, $name, "warning: trace info was not inserted because of NO TRACE comment";
|
||||
}
|
||||
# Ignored due to NO TRACE comment.
|
||||
} elsif ($body =~ s/((\n[ \t]*)H5TRACE\d+\s*\(.*?\);)\n/"$2$trace"/es) {
|
||||
# Replaced an H5TRACE macro
|
||||
} elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*\(.*?\);??)\n/"$1$2$trace"/es) {
|
||||
# Replaced an H5TRACE macro.
|
||||
} elsif ($body=~s/((\n[ \t]*)FUNC_ENTER\w*\s*(\(.*?\))?;??)\n/"$1$2$trace"/es) {
|
||||
# Added an H5TRACE macro after a FUNC_ENTER macro.
|
||||
} else {
|
||||
errmesg $file, $name, "unable to insert tracing information";
|
||||
@@ -297,14 +317,14 @@ for $file (@ARGV) {
|
||||
|
||||
# Make modifications
|
||||
my $original = $Source;
|
||||
my $napi = $Source =~ s/\n([A-Za-z]\w*(\s+[a-z]\w*)*)\s*\n #type
|
||||
my $napi = $Source =~ s/\n([A-Za-z]\w*(\s+[A-Za-z]\w*)*\s*\**)\n #type
|
||||
(H5[A-Z]{0,2}[^_A-Z0-9]\w*) #name
|
||||
\s*\((.*?)\)\s* #args
|
||||
(\{.*?\n\}[^\n]*) #body
|
||||
/rewrite_func($file,$1,$3,$4,$5)/segx;
|
||||
$total_api += $napi;
|
||||
|
||||
# If the source changed then print out the new version
|
||||
# If the source changed then print out the new version
|
||||
if ($original ne $Source) {
|
||||
printf "%s: instrumented %d API function%s\n",
|
||||
$file, $napi, 1==$napi?"":"s";
|
||||
@@ -315,3 +335,6 @@ for $file (@ARGV) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf "Finished processing HDF5 API calls\n"
|
||||
|
||||
|
||||
53
c++/CMakeLists.txt
Normal file
53
c++/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
cmake_minimum_required (VERSION 3.1.0)
|
||||
PROJECT (HDF5_CPP)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Apply Definitions to compiler in this directory and below
|
||||
#-----------------------------------------------------------------------------
|
||||
add_definitions (${HDF_EXTRA_C_FLAGS})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Shared/Static Libs
|
||||
#-----------------------------------------------------------------------------
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (CPP_BUILT_AS_DYNAMIC_LIB 1)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
set (CPP_BUILT_AS_STATIC_LIB 1)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generate configure file
|
||||
#-----------------------------------------------------------------------------
|
||||
configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in
|
||||
${HDF5_BINARY_DIR}/H5cxx_pubconf.h
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup Include directories
|
||||
#-----------------------------------------------------------------------------
|
||||
INCLUDE_DIRECTORIES (${HDF5_CPP_SOURCE_DIR}/src)
|
||||
INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR})
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Parallel/MPI, prevent spurious cpp/cxx warnings
|
||||
#-----------------------------------------------------------------------------
|
||||
if (H5_HAVE_PARALLEL)
|
||||
add_definitions ("-DMPICH_SKIP_MPICXX")
|
||||
add_definitions ("-DMPICH_IGNORE_CXX_SEEK")
|
||||
endif (H5_HAVE_PARALLEL)
|
||||
|
||||
add_subdirectory (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build the CPP Examples
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_BUILD_EXAMPLES)
|
||||
add_subdirectory (${HDF5_CPP_SOURCE_DIR}/examples ${HDF5_CPP_BINARY_DIR}/examples)
|
||||
endif (HDF5_BUILD_EXAMPLES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build the CPP unit tests
|
||||
#-----------------------------------------------------------------------------
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory (${HDF5_CPP_SOURCE_DIR}/test ${HDF5_CPP_BINARY_DIR}/test)
|
||||
endif (BUILD_TESTING)
|
||||
2
c++/COPYING
Executable file → Normal file
2
c++/COPYING
Executable file → Normal file
@@ -1,5 +1,5 @@
|
||||
|
||||
Copyright by The HDF Group (THG) and
|
||||
Copyright by The HDF Group and
|
||||
The Board of Trustees of the University of Illinois.
|
||||
All rights reserved.
|
||||
|
||||
|
||||
867
c++/Makefile.in
867
c++/Makefile.in
File diff suppressed because it is too large
Load Diff
53
c++/examples/CMakeLists.txt
Normal file
53
c++/examples/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
cmake_minimum_required (VERSION 3.1.0)
|
||||
# --------------------------------------------------------------------
|
||||
# Notes: When creating examples they should be prefixed
|
||||
# with "cpp_ex_". This allows for easier filtering of the examples.
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
PROJECT (HDF5_CPP_EXAMPLES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Define examples
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
set (examples
|
||||
create
|
||||
readdata
|
||||
writedata
|
||||
compound
|
||||
extend_ds
|
||||
chunks
|
||||
h5group
|
||||
)
|
||||
|
||||
set (tutr_examples
|
||||
h5tutr_cmprss
|
||||
h5tutr_crtdat
|
||||
h5tutr_crtatt
|
||||
h5tutr_crtgrpar
|
||||
h5tutr_crtgrp
|
||||
h5tutr_crtgrpd
|
||||
h5tutr_extend
|
||||
h5tutr_rdwt
|
||||
h5tutr_subset
|
||||
)
|
||||
|
||||
foreach (example ${examples})
|
||||
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
|
||||
TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE})
|
||||
TARGET_C_PROPERTIES (cpp_ex_${example} ${LIB_TYPE} " " " ")
|
||||
target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
|
||||
endforeach (example ${examples})
|
||||
|
||||
foreach (example ${tutr_examples})
|
||||
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
|
||||
TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE})
|
||||
TARGET_C_PROPERTIES (cpp_ex_${example} ${LIB_TYPE} " " " ")
|
||||
target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
|
||||
endforeach (example ${tutr_examples})
|
||||
|
||||
if (BUILD_TESTING)
|
||||
include (CMakeTests.cmake)
|
||||
endif (BUILD_TESTING)
|
||||
61
c++/examples/CMakeTests.cmake
Normal file
61
c++/examples/CMakeTests.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
### T E S T I N G ###
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
# Remove any output file left over from previous test run
|
||||
add_test (
|
||||
NAME CPP_ex-clear-objects
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E remove
|
||||
Group.h5
|
||||
SDS.h5
|
||||
SDScompound.h5
|
||||
SDSextendible.h5
|
||||
Select.h5
|
||||
)
|
||||
if (NOT "${last_test}" STREQUAL "")
|
||||
set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test})
|
||||
endif (NOT "${last_test}" STREQUAL "")
|
||||
set (last_test "CPP_ex-clear-objects")
|
||||
|
||||
foreach (example ${examples})
|
||||
add_test (NAME CPP_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>)
|
||||
if (NOT "${last_test}" STREQUAL "")
|
||||
set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
|
||||
endif (NOT "${last_test}" STREQUAL "")
|
||||
set (last_test "CPP_ex_${example}")
|
||||
endforeach (example ${examples})
|
||||
#the following dependicies are handled by the order of the files
|
||||
# SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create)
|
||||
# SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds)
|
||||
|
||||
add_test (
|
||||
NAME CPP_ex_tutr-clear-objects
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-E remove
|
||||
h5tutr_cmprss.h5
|
||||
h5tutr_dset.h5
|
||||
h5tutr_extend.h5
|
||||
h5tutr_group.h5
|
||||
h5tutr_groups.h5
|
||||
h5tutr_subset.h5
|
||||
)
|
||||
if (NOT "${last_test}" STREQUAL "")
|
||||
set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test})
|
||||
endif (NOT "${last_test}" STREQUAL "")
|
||||
set (last_test "CPP_ex_tutr-clear-objects")
|
||||
|
||||
foreach (example ${tutr_examples})
|
||||
add_test (NAME CPP_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>)
|
||||
if (NOT "${last_test}" STREQUAL "")
|
||||
set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test})
|
||||
endif (NOT "${last_test}" STREQUAL "")
|
||||
set (last_test "CPP_ex_${example}")
|
||||
endforeach (example ${tutr_examples})
|
||||
#the following dependicies are handled by the order of the files
|
||||
# SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtatt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat)
|
||||
# SET_TESTS_PROPERTIES(CPP_ex_h5tutr_rdwt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat)
|
||||
# SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtgrpd PROPERTIES DEPENDS CPP_ex_h5tutr_crtgrpar)
|
||||
|
||||
@@ -21,24 +21,38 @@
|
||||
|
||||
include $(top_srcdir)/config/commence.am
|
||||
|
||||
INSTALL_SCRIPT_FILES = run-c++-ex.sh
|
||||
|
||||
# These are the programs that 'make all' or 'make prog' will build and
|
||||
# which 'make check' will run. List them in the order they should be run.
|
||||
TEST_PROG=create readdata writedata compound extend_ds chunks h5group
|
||||
EXAMPLE_PROG=create readdata writedata compound extend_ds chunks h5group \
|
||||
h5tutr_cmprss h5tutr_crtatt h5tutr_crtdat h5tutr_crtgrpar \
|
||||
h5tutr_crtgrp h5tutr_crtgrpd h5tutr_extend h5tutr_rdwt \
|
||||
h5tutr_subset
|
||||
TEST_SCRIPT=testh5c++.sh
|
||||
TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES)
|
||||
|
||||
# These are the example files to be installed
|
||||
INSTALL_FILES=create.cpp readdata.cpp writedata.cpp compound.cpp \
|
||||
extend_ds.cpp chunks.cpp h5group.cpp
|
||||
INSTALL_FILES=create.cpp readdata.cpp writedata.cpp compound.cpp \
|
||||
extend_ds.cpp chunks.cpp h5group.cpp \
|
||||
h5tutr_cmprss.cpp h5tutr_crtatt.cpp h5tutr_crtdat.cpp \
|
||||
h5tutr_crtgrpar.cpp h5tutr_crtgrp.cpp h5tutr_crtgrpd.cpp \
|
||||
h5tutr_extend.cpp h5tutr_rdwt.cpp h5tutr_subset.cpp
|
||||
|
||||
# Some of the examples depend on files created by running other examples
|
||||
readdata.chkexe_: create.chkexe_
|
||||
chunks.chkexe_: extend_ds.chkexe_
|
||||
h5tutr_rdwt.chkexe_: h5tutr_crtdat.chkexe
|
||||
h5tutrcrtatt.chkexe_: h5tutr_crtdat.chkexe
|
||||
h5tutr_crtgrpd.chkexe_: h5tutr_crtgrpar.chkexe
|
||||
|
||||
# Tell conclude.am that these are C++ tests.
|
||||
CXX_API=yes
|
||||
|
||||
# Where to install examples
|
||||
EXAMPLEDIR=$(docdir)/hdf5/examples/c++
|
||||
# Note: no '/' after DESTDIR. Explanation in commence.am
|
||||
EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/c++
|
||||
EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples
|
||||
|
||||
# How to build programs using h5c++
|
||||
$(EXTRA_PROG): $(H5CPP)
|
||||
@@ -56,5 +70,15 @@ extend_ds: $(srcdir)/extend_ds.cpp
|
||||
chunks: $(srcdir)/chunks.cpp
|
||||
h5group: $(srcdir)/h5group.cpp
|
||||
|
||||
h5tutr_cmprss: $(srcdir)/h5tutr_cmprss.cpp
|
||||
h5tutr_crtatt: $(srcdir)/h5tutr_crtatt.cpp
|
||||
h5tutr_crtdat: $(srcdir)/h5tutr_crtdat.cpp
|
||||
h5tutr_crtgrpar: $(srcdir)/h5tutr_crtgrpar.cpp
|
||||
h5tutr_crtgrp: $(srcdir)/h5tutr_crtgrp.cpp
|
||||
h5tutr_crtgrpd: $(srcdir)/h5tutr_crtgrpd.cpp
|
||||
h5tutr_extend: $(srcdir)/h5tutr_extend.cpp
|
||||
h5tutr_rdwt: $(srcdir)/h5tutr_rdwt.cpp
|
||||
h5tutr_subset: $(srcdir)/h5tutr_subset.cpp
|
||||
|
||||
include $(top_srcdir)/config/examples.am
|
||||
include $(top_srcdir)/config/conclude.am
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
162
c++/examples/h5tutr_cmprss.cpp
Normal file
162
c++/examples/h5tutr_cmprss.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to create a compressed dataset.
|
||||
* It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#ifndef H5_NO_STD
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_cmprss.h5");
|
||||
const H5std_string DATASET_NAME("Compressed_Data");
|
||||
const int DIM0 = 100;
|
||||
const int DIM1 = 20;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions
|
||||
hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions
|
||||
int i,j, buf[DIM0][DIM1];
|
||||
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Create a new file using the default property lists.
|
||||
H5File file(FILE_NAME, H5F_ACC_TRUNC);
|
||||
|
||||
// Create the data space for the dataset.
|
||||
DataSpace *dataspace = new DataSpace(2, dims);
|
||||
|
||||
// Modify dataset creation property to enable chunking
|
||||
DSetCreatPropList *plist = new DSetCreatPropList;
|
||||
plist->setChunk(2, chunk_dims);
|
||||
|
||||
// Set ZLIB (DEFLATE) Compression using level 6.
|
||||
// To use SZIP compression comment out this line.
|
||||
plist->setDeflate(6);
|
||||
|
||||
// Uncomment these lines to set SZIP Compression
|
||||
// unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK;
|
||||
// unsigned szip_pixels_per_block = 16;
|
||||
// plist->setSzip(szip_options_mask, szip_pixels_per_block);
|
||||
|
||||
// Create the dataset.
|
||||
DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME,
|
||||
PredType::STD_I32BE, *dataspace, *plist) );
|
||||
|
||||
for (i = 0; i< DIM0; i++)
|
||||
for (j=0; j<DIM1; j++)
|
||||
buf[i][j] = i+j;
|
||||
|
||||
// Write data to dataset.
|
||||
dataset->write(buf, PredType::NATIVE_INT);
|
||||
|
||||
// Close objects and file. Either approach will close the HDF5 item.
|
||||
delete dataspace;
|
||||
delete dataset;
|
||||
delete plist;
|
||||
file.close();
|
||||
|
||||
// -----------------------------------------------
|
||||
// Re-open the file and dataset, retrieve filter
|
||||
// information for dataset and read the data back.
|
||||
// -----------------------------------------------
|
||||
|
||||
int rbuf[DIM0][DIM1];
|
||||
int numfilt;
|
||||
size_t nelmts={1}, namelen={1};
|
||||
unsigned flags, filter_info, cd_values[1], idx;
|
||||
char name[1];
|
||||
H5Z_filter_t filter_type;
|
||||
|
||||
// Open the file and the dataset in the file.
|
||||
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
|
||||
dataset = new DataSet(file.openDataSet( DATASET_NAME));
|
||||
|
||||
// Get the create property list of the dataset.
|
||||
plist = new DSetCreatPropList(dataset->getCreatePlist ());
|
||||
|
||||
// Get the number of filters associated with the dataset.
|
||||
numfilt = plist->getNfilters();
|
||||
cout << "Number of filters associated with dataset: " << numfilt << endl;
|
||||
|
||||
for (idx=0; idx < numfilt; idx++) {
|
||||
nelmts = 0;
|
||||
|
||||
filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info);
|
||||
|
||||
cout << "Filter Type: ";
|
||||
|
||||
switch (filter_type) {
|
||||
case H5Z_FILTER_DEFLATE:
|
||||
cout << "H5Z_FILTER_DEFLATE" << endl;
|
||||
break;
|
||||
case H5Z_FILTER_SZIP:
|
||||
cout << "H5Z_FILTER_SZIP" << endl;
|
||||
break;
|
||||
default:
|
||||
cout << "Other filter type included." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Read data.
|
||||
dataset->read(rbuf, PredType::NATIVE_INT);
|
||||
|
||||
delete plist;
|
||||
delete dataset;
|
||||
file.close(); // can be skipped
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSet operations
|
||||
catch(DataSetIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSpace operations
|
||||
catch(DataSpaceIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // successfully terminated
|
||||
}
|
||||
|
||||
95
c++/examples/h5tutr_crtatt.cpp
Normal file
95
c++/examples/h5tutr_crtatt.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to create an attribute attached to a
|
||||
* dataset. It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME( "h5tutr_dset.h5" );
|
||||
const H5std_string DATASET_NAME( "dset" );
|
||||
const H5std_string ATTR_NAME( "Units" );
|
||||
|
||||
const int DIM1 = 2;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int attr_data[2] = { 100, 200};
|
||||
hsize_t dims[1] = { DIM1 };
|
||||
|
||||
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Open an existing file and dataset.
|
||||
H5File file( FILE_NAME, H5F_ACC_RDWR );
|
||||
DataSet dataset = file.openDataSet( DATASET_NAME );
|
||||
|
||||
// Create the data space for the attribute.
|
||||
DataSpace attr_dataspace = DataSpace (1, dims );
|
||||
|
||||
// Create a dataset attribute.
|
||||
Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE,
|
||||
attr_dataspace);
|
||||
|
||||
// Write the attribute data.
|
||||
attribute.write( PredType::NATIVE_INT, attr_data);
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch( DataSpaceIException error )
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch( AttributeIException error )
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch( FileIException error )
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSet operations
|
||||
catch( DataSetIException error )
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // successfully terminated
|
||||
}
|
||||
|
||||
82
c++/examples/h5tutr_crtdat.cpp
Normal file
82
c++/examples/h5tutr_crtdat.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to create a dataset that is a 4 x 6
|
||||
* array. It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_dset.h5");
|
||||
const H5std_string DATASET_NAME("dset");
|
||||
const int NX = 4; // dataset dimensions
|
||||
const int NY = 6;
|
||||
const int RANK = 2;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Create a new file using the default property lists.
|
||||
H5File file(FILE_NAME, H5F_ACC_TRUNC);
|
||||
|
||||
// Create the data space for the dataset.
|
||||
hsize_t dims[2]; // dataset dimensions
|
||||
dims[0] = NX;
|
||||
dims[1] = NY;
|
||||
DataSpace dataspace(RANK, dims);
|
||||
|
||||
// Create the dataset.
|
||||
DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace);
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSet operations
|
||||
catch(DataSetIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSpace operations
|
||||
catch(DataSpaceIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // successfully terminated
|
||||
}
|
||||
|
||||
69
c++/examples/h5tutr_crtgrp.cpp
Normal file
69
c++/examples/h5tutr_crtgrp.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to create and close a group.
|
||||
* It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#ifndef H5_NO_STD
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_group.h5");
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Create a new file using default property lists.
|
||||
H5File file(FILE_NAME, H5F_ACC_TRUNC);
|
||||
|
||||
// Create a group named "/MygGroup" in the file
|
||||
Group group(file.createGroup("/MyGroup"));
|
||||
|
||||
// File and group will be closed as their instances go out of scope.
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
// catch failure caused by the Group operations
|
||||
catch(GroupIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
92
c++/examples/h5tutr_crtgrpar.cpp
Normal file
92
c++/examples/h5tutr_crtgrpar.cpp
Normal file
@@ -0,0 +1,92 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates the creation of groups using absolute and
|
||||
* relative names. It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#ifndef H5_NO_STD
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_groups.h5");
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately.
|
||||
|
||||
Exception::dontPrint();
|
||||
|
||||
// Create a new file using default properties.
|
||||
|
||||
H5File file(FILE_NAME, H5F_ACC_TRUNC);
|
||||
|
||||
// Create group "MyGroup" in the root group using an absolute name.
|
||||
|
||||
Group group1(file.createGroup( "/MyGroup"));
|
||||
|
||||
// Create group "Group_A" in group "MyGroup" using an
|
||||
// absolute name.
|
||||
|
||||
Group group2(file.createGroup("/MyGroup/Group_A"));
|
||||
|
||||
// Create group "Group_B" in group "MyGroup" using a
|
||||
// relative name.
|
||||
|
||||
Group group3(group1.createGroup ("Group_B"));
|
||||
|
||||
// Close the groups and file.
|
||||
|
||||
group1.close();
|
||||
group2.close();
|
||||
group3.close();
|
||||
file.close();
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the Group operations
|
||||
catch(GroupIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
141
c++/examples/h5tutr_crtgrpd.cpp
Normal file
141
c++/examples/h5tutr_crtgrpd.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to create a dataset in a group.
|
||||
* It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#ifndef H5_NO_STD
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_groups.h5");
|
||||
const H5std_string DATASET_NAME1("/MyGroup/dset1");
|
||||
const H5std_string DATASET_NAME2("dset2");
|
||||
const int RANK = 2;
|
||||
const int D1DIM1 = 3;
|
||||
const int D1DIM2 = 3;
|
||||
const int D2DIM1 = 2;
|
||||
const int D2DIM2 = 10;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int dset1_data[D1DIM1][D1DIM2], dset2_data[D2DIM1][D2DIM2]; // data buffers
|
||||
int i, j;
|
||||
|
||||
// Try block to catch exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Initialize the first dataset.
|
||||
for (i = 0; i < D1DIM1; i++)
|
||||
for (j = 0; j < D1DIM2; j++)
|
||||
dset1_data[i][j] = j + 1;
|
||||
|
||||
// Initialize the second dataset.
|
||||
for (i = 0; i < D2DIM1; i++)
|
||||
for (j = 0; j < D2DIM2; j++)
|
||||
dset2_data[i][j] = j + 1;
|
||||
|
||||
// Open an existing file and dataset.
|
||||
H5File file(FILE_NAME, H5F_ACC_RDWR);
|
||||
|
||||
// Create the data space for the first dataset. Note the use of
|
||||
// pointer for the instance 'dataspace'. It can be deleted and
|
||||
// used again later for another data space. An HDF5 identifier is
|
||||
// closed by the destructor or the method 'close()'.
|
||||
hsize_t dims[RANK]; // dataset dimensions
|
||||
dims[0] = D1DIM1;
|
||||
dims[1] = D1DIM2;
|
||||
DataSpace *dataspace = new DataSpace (RANK, dims);
|
||||
|
||||
// Create the dataset in group "MyGroup". Same note as for the
|
||||
// dataspace above.
|
||||
DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1,
|
||||
PredType::STD_I32BE, *dataspace));
|
||||
|
||||
// Write the data to the dataset using default memory space, file
|
||||
// space, and transfer properties.
|
||||
dataset->write(dset1_data, PredType::NATIVE_INT);
|
||||
|
||||
// Close the current dataset and data space.
|
||||
delete dataset;
|
||||
delete dataspace;
|
||||
|
||||
// Create the data space for the second dataset.
|
||||
dims[0] = D2DIM1;
|
||||
dims[1] = D2DIM2;
|
||||
dataspace = new DataSpace (RANK, dims);
|
||||
|
||||
// Create group "Group_A" in group "MyGroup".
|
||||
Group group(file.openGroup("/MyGroup/Group_A"));
|
||||
|
||||
// Create the second dataset in group "Group_A".
|
||||
dataset = new DataSet (group.createDataSet(DATASET_NAME2,
|
||||
PredType::STD_I32BE, *dataspace));
|
||||
|
||||
// Write the data to the dataset using default memory space, file
|
||||
// space, and transfer properties.
|
||||
dataset->write(dset2_data, PredType::NATIVE_INT);
|
||||
|
||||
// Close all objects.
|
||||
delete dataspace;
|
||||
delete dataset;
|
||||
group.close();
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
// catch failure caused by the DataSet operations
|
||||
catch(DataSetIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSpace operations
|
||||
catch(DataSpaceIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the Group operations
|
||||
catch(GroupIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
177
c++/examples/h5tutr_extend.cpp
Normal file
177
c++/examples/h5tutr_extend.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to create a dataset that is a 4 x 6
|
||||
* array. It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#ifndef H5_NO_STD
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_extend.h5");
|
||||
const H5std_string DATASETNAME("ExtendibleArray");
|
||||
|
||||
int main (void)
|
||||
{
|
||||
hsize_t dims[2] = {3,3}; // dataset dimensions at creation
|
||||
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
|
||||
hsize_t chunk_dims[2] ={2, 5};
|
||||
int data[3][3] = { {1, 1, 1}, // data to write
|
||||
{1, 1, 1},
|
||||
{1, 1, 1} };
|
||||
|
||||
// Variables used in extending and writing to the extended portion of dataset
|
||||
|
||||
hsize_t size[2];
|
||||
hsize_t offset[2];
|
||||
hsize_t dimsext[2] = {7, 3}; // extend dimensions
|
||||
int dataext[7][3] = { {2, 3, 4},
|
||||
{2, 3, 4},
|
||||
{2, 3, 4},
|
||||
{2, 3, 4},
|
||||
{2, 3, 4},
|
||||
{2, 3, 4},
|
||||
{2, 3, 4} };
|
||||
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Create a new file using the default property lists.
|
||||
H5File file(FILE_NAME, H5F_ACC_TRUNC);
|
||||
|
||||
// Create the data space for the dataset. Note the use of pointer
|
||||
// for the instance 'dataspace'. It can be deleted and used again
|
||||
// later for another dataspace. An HDF5 identifier can be closed
|
||||
// by the destructor or the method 'close()'.
|
||||
DataSpace *dataspace = new DataSpace (2, dims, maxdims);
|
||||
|
||||
// Modify dataset creation property to enable chunking
|
||||
DSetCreatPropList prop;
|
||||
prop.setChunk(2, chunk_dims);
|
||||
|
||||
// Create the chunked dataset. Note the use of pointer.
|
||||
DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME,
|
||||
PredType::STD_I32BE, *dataspace, prop) );
|
||||
|
||||
// Write data to dataset.
|
||||
dataset->write(data, PredType::NATIVE_INT);
|
||||
|
||||
// Extend the dataset. Dataset becomes 10 x 3.
|
||||
size[0] = dims[0] + dimsext[0];
|
||||
size[1] = dims[1];
|
||||
dataset->extend(size);
|
||||
|
||||
// Select a hyperslab in extended portion of the dataset.
|
||||
DataSpace *filespace = new DataSpace(dataset->getSpace ());
|
||||
offset[0] = 3;
|
||||
offset[1] = 0;
|
||||
filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset);
|
||||
|
||||
// Define memory space.
|
||||
DataSpace *memspace = new DataSpace(2, dimsext, NULL);
|
||||
|
||||
// Write data to the extended portion of the dataset.
|
||||
dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace);
|
||||
|
||||
// Close all objects and file.
|
||||
prop.close();
|
||||
delete filespace;
|
||||
delete memspace;
|
||||
delete dataspace;
|
||||
delete dataset;
|
||||
file.close();
|
||||
|
||||
// ---------------------------------------
|
||||
// Re-open the file and read the data back
|
||||
// ---------------------------------------
|
||||
|
||||
int rdata[10][3];
|
||||
int i,j, rank, rank_chunk;
|
||||
hsize_t chunk_dimsr[2], dimsr[2];
|
||||
|
||||
// Open the file and dataset.
|
||||
file.openFile(FILE_NAME, H5F_ACC_RDONLY);
|
||||
dataset = new DataSet(file.openDataSet( DATASETNAME));
|
||||
|
||||
// Get the dataset's dataspace and creation property list.
|
||||
filespace = new DataSpace(dataset->getSpace());
|
||||
prop = dataset->getCreatePlist();
|
||||
|
||||
// Get information to obtain memory dataspace.
|
||||
rank = filespace->getSimpleExtentNdims();
|
||||
herr_t status_n = filespace->getSimpleExtentDims(dimsr);
|
||||
|
||||
if (H5D_CHUNKED == prop.getLayout())
|
||||
rank_chunk = prop.getChunk(rank, chunk_dimsr);
|
||||
cout << "rank chunk = " << rank_chunk << endl;;
|
||||
|
||||
memspace = new DataSpace(rank, dimsr, NULL);
|
||||
dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace);
|
||||
|
||||
cout << endl;
|
||||
for (j = 0; j < dimsr[0]; j++) {
|
||||
for (i = 0; i < dimsr[1]; i++)
|
||||
cout << " " << rdata[j][i];
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
// Close all objects and file.
|
||||
prop.close();
|
||||
delete filespace;
|
||||
delete memspace;
|
||||
delete dataset;
|
||||
file.close();
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSet operations
|
||||
catch(DataSetIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSpace operations
|
||||
catch(DataSpaceIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // successfully terminated
|
||||
}
|
||||
|
||||
79
c++/examples/h5tutr_rdwt.cpp
Normal file
79
c++/examples/h5tutr_rdwt.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to write to and read from an existing
|
||||
* dataset. It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_dset.h5");
|
||||
const H5std_string DATASET_NAME("dset");
|
||||
const int DIM0 = 4; // dataset dimensions
|
||||
const int DIM1 = 6;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
|
||||
// Data initialization.
|
||||
|
||||
int i, j;
|
||||
int data[DIM0][DIM1]; // buffer for data to write
|
||||
|
||||
for (j = 0; j < DIM0; j++)
|
||||
for (i = 0; i < DIM1; i++)
|
||||
data[j][i] = i * 6 + j + 1;
|
||||
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// Open an existing file and dataset.
|
||||
H5File file(FILE_NAME, H5F_ACC_RDWR);
|
||||
DataSet dataset = file.openDataSet(DATASET_NAME);
|
||||
|
||||
// Write the data to the dataset using default memory space, file
|
||||
// space, and transfer properties.
|
||||
dataset.write(data, PredType::NATIVE_INT);
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSet operations
|
||||
catch(DataSetIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // successfully terminated
|
||||
}
|
||||
183
c++/examples/h5tutr_subset.cpp
Normal file
183
c++/examples/h5tutr_subset.cpp
Normal file
@@ -0,0 +1,183 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* 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. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This example illustrates how to read/write a subset of data (a slab)
|
||||
* from/to a dataset in an HDF5 file. It is used in the HDF5 Tutorial.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "H5Cpp.h"
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
using namespace H5;
|
||||
#ifndef H5_NO_STD
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
const H5std_string FILE_NAME("h5tutr_subset.h5");
|
||||
const H5std_string DATASET_NAME("IntArray");
|
||||
|
||||
const int RANK = 2;
|
||||
const int DIM0_SUB = 3; // subset dimensions
|
||||
const int DIM1_SUB = 4;
|
||||
const int DIM0 = 8; // size of dataset
|
||||
const int DIM1 = 10;
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int i,j;
|
||||
int data[DIM0][DIM1], sdata[DIM0_SUB][DIM1_SUB], rdata[DIM0][DIM1];
|
||||
|
||||
// Try block to detect exceptions raised by any of the calls inside it
|
||||
try
|
||||
{
|
||||
// Turn off the auto-printing when failure occurs so that we can
|
||||
// handle the errors appropriately
|
||||
Exception::dontPrint();
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Create a new file using the default property lists.
|
||||
// Then create a dataset and write data to it.
|
||||
// Close the file and dataset.
|
||||
// ---------------------------------------------------
|
||||
|
||||
H5File file(FILE_NAME, H5F_ACC_TRUNC);
|
||||
|
||||
hsize_t dims[2];
|
||||
dims[0] = DIM0;
|
||||
dims[1] = DIM1;
|
||||
DataSpace dataspace = DataSpace (RANK, dims);
|
||||
|
||||
DataSet dataset(file.createDataSet( DATASET_NAME,
|
||||
PredType::STD_I32BE, dataspace) );
|
||||
|
||||
|
||||
for (j = 0; j < DIM0; j++) {
|
||||
for (i = 0; i < DIM1; i++)
|
||||
if (i< (DIM1/2))
|
||||
data[j][i] = 1;
|
||||
else
|
||||
data[j][i] = 2;
|
||||
}
|
||||
|
||||
dataset.write(data, PredType::NATIVE_INT);
|
||||
|
||||
cout << endl << "Data Written to File:" << endl;
|
||||
for (j = 0; j < DIM0; j++) {
|
||||
for (i = 0; i < DIM1; i++)
|
||||
cout << " " << data[j][i];
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
dataspace.close();
|
||||
dataset.close();
|
||||
file.close();
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Reopen the file and dataset and write a subset of
|
||||
// values to the dataset.
|
||||
// ---------------------------------------------------
|
||||
|
||||
hsize_t offset[2], count[2], stride[2], block[2];
|
||||
hsize_t dimsm[2];
|
||||
|
||||
file.openFile(FILE_NAME, H5F_ACC_RDWR);
|
||||
dataset = file.openDataSet(DATASET_NAME);
|
||||
|
||||
// Specify size and shape of subset to write.
|
||||
|
||||
offset[0] = 1;
|
||||
offset[1] = 2;
|
||||
|
||||
count[0] = DIM0_SUB;
|
||||
count[1] = DIM1_SUB;
|
||||
|
||||
stride[0] = 1;
|
||||
stride[1] = 1;
|
||||
|
||||
block[0] = 1;
|
||||
block[1] = 1;
|
||||
|
||||
// Define Memory Dataspace. Get file dataspace and select
|
||||
// a subset from the file dataspace.
|
||||
|
||||
dimsm[0] = DIM0_SUB;
|
||||
dimsm[1] = DIM1_SUB;
|
||||
|
||||
DataSpace memspace(RANK, dimsm, NULL);
|
||||
|
||||
dataspace = dataset.getSpace();
|
||||
dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block);
|
||||
|
||||
// Write a subset of data to the dataset, then read the
|
||||
// entire dataset back from the file.
|
||||
|
||||
cout << endl << "Write subset to file specifying: " << endl;
|
||||
cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl;
|
||||
for (j = 0; j < DIM0_SUB; j++) {
|
||||
for (i = 0; i < DIM1_SUB; i++)
|
||||
sdata[j][i] = 5;
|
||||
}
|
||||
|
||||
dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace);
|
||||
dataset.read(rdata, PredType::NATIVE_INT);
|
||||
|
||||
|
||||
cout << endl << "Data in File after Subset is Written:" << endl;
|
||||
for (i = 0; i < DIM0; i++) {
|
||||
for (j = 0; j < DIM1; j++)
|
||||
cout << " " << rdata[i][j];
|
||||
cout << endl;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
// It is not necessary to close these objects because close() will
|
||||
// be called when the object instances are going out of scope.
|
||||
dataspace.close();
|
||||
memspace.close();
|
||||
dataset.close();
|
||||
file.close();
|
||||
|
||||
} // end of try block
|
||||
|
||||
// catch failure caused by the H5File operations
|
||||
catch(FileIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSet operations
|
||||
catch(DataSetIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// catch failure caused by the DataSpace operations
|
||||
catch(DataSpaceIException error)
|
||||
{
|
||||
error.printError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0; // successfully terminated
|
||||
}
|
||||
|
||||
124
c++/examples/run-c++-ex.sh.in
Normal file
124
c++/examples/run-c++-ex.sh.in
Normal file
@@ -0,0 +1,124 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright by The HDF Group.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This file is part of HDF5. The full HDF5 copyright notice, including
|
||||
# terms governing use, modification, and redistribution, is contained in
|
||||
# the 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.
|
||||
|
||||
#
|
||||
# This file: run-c++-ex.sh
|
||||
# Written by: Larry Knox
|
||||
# Date: May 11, 2010
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# This script will compile and run the c++ examples from source files #
|
||||
# installed in .../share/hdf5_examples/c++ using h5c++. The #
|
||||
# order for running programs with RunTest in the MAIN section below is taken #
|
||||
# from the Makefile. The order is important since some of the test programs #
|
||||
# use data files created by earlier test programs. Any future additions should #
|
||||
# be placed accordingly. #
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
# Initializations
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_FAILURE=1
|
||||
|
||||
# Where the tool is installed.
|
||||
# default is relative path to installed location of the tools
|
||||
prefix="${prefix:-@prefix@}"
|
||||
AR="@AR@"
|
||||
RANLIB="@RANLIB@"
|
||||
H5TOOL="h5c++" # The tool name
|
||||
H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary
|
||||
|
||||
#### Run test ####
|
||||
RunTest()
|
||||
{
|
||||
TEST_EXEC=$1
|
||||
Test=$1".cpp"
|
||||
|
||||
echo
|
||||
echo "################# $1 #################"
|
||||
${H5TOOL_BIN} -o $TEST_EXEC $Test
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "messed up compiling $Test"
|
||||
exit 1
|
||||
fi
|
||||
./$TEST_EXEC
|
||||
}
|
||||
|
||||
|
||||
|
||||
################## MAIN ##################
|
||||
|
||||
# Run tests
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "*************************************************"
|
||||
echo "** Run C++ API Examples **"
|
||||
echo "** **"
|
||||
echo "*************************************************"
|
||||
if (RunTest create &&\
|
||||
rm create &&\
|
||||
RunTest readdata &&\
|
||||
rm readdata &&\
|
||||
RunTest writedata &&\
|
||||
rm writedata &&\
|
||||
RunTest compound &&\
|
||||
rm compound &&\
|
||||
RunTest extend_ds &&\
|
||||
rm extend_ds &&\
|
||||
RunTest chunks &&\
|
||||
rm chunks &&\
|
||||
RunTest h5group &&\
|
||||
rm h5group); then
|
||||
EXIT_VALUE=${EXIT_SUCCESS}
|
||||
else
|
||||
EXIT_VALUE=${EXIT_FAILURE}
|
||||
fi
|
||||
echo
|
||||
echo "***************************************************"
|
||||
echo "** Run Tutorial Examples **"
|
||||
echo "** **"
|
||||
echo "***************************************************"
|
||||
if (RunTest h5tutr_crtdat &&\
|
||||
rm h5tutr_crtdat &&\
|
||||
RunTest h5tutr_rdwt &&\
|
||||
rm h5tutr_rdwt &&\
|
||||
RunTest h5tutr_crtatt &&\
|
||||
rm h5tutr_crtatt &&\
|
||||
RunTest h5tutr_crtgrp &&\
|
||||
rm h5tutr_crtgrp &&\
|
||||
RunTest h5tutr_crtgrpar &&\
|
||||
rm h5tutr_crtgrpar &&\
|
||||
RunTest h5tutr_crtgrpd &&\
|
||||
rm h5tutr_crtgrpd &&\
|
||||
RunTest h5tutr_extend &&\
|
||||
rm h5tutr_extend &&\
|
||||
RunTest h5tutr_subset &&\
|
||||
rm h5tutr_subset &&\
|
||||
RunTest h5tutr_cmprss &&\
|
||||
rm h5tutr_cmprss ); then
|
||||
EXIT_VALUE=${EXIT_SUCCESS}
|
||||
else
|
||||
EXIT_VALUE=${EXIT_FAILURE}
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm *.o
|
||||
rm *.h5
|
||||
echo
|
||||
|
||||
exit $EXIT_VALUE
|
||||
|
||||
25
c++/examples/testh5c++.sh.in
Executable file → Normal file
25
c++/examples/testh5c++.sh.in
Executable file → Normal file
@@ -19,29 +19,30 @@
|
||||
# Modification:
|
||||
#
|
||||
|
||||
srcdir=@srcdir@
|
||||
|
||||
# Initializations
|
||||
TESTNAME=h5c++
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_FAILURE=1
|
||||
|
||||
# Where the tool is installed.
|
||||
prefix="${prefix:-@prefix@}"
|
||||
AR=@AR@
|
||||
RANLIB=@RANLIB@
|
||||
AR="@AR@"
|
||||
RANLIB="@RANLIB@"
|
||||
H5TOOL="h5c++" # The tool name
|
||||
H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary
|
||||
|
||||
CMP='cmp -s'
|
||||
DIFF='diff -c'
|
||||
|
||||
nerrors=0
|
||||
nerrors=$EXIT_SUCCESS
|
||||
verbose=yes
|
||||
|
||||
# setup my machine information.
|
||||
myos=`uname -s`
|
||||
myhostnama=`uname -n`
|
||||
|
||||
# The build (current) directory might be different than the source directory.
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=.
|
||||
fi
|
||||
|
||||
# Generate some source files and library for tests.
|
||||
suffix=cpp # source file suffix
|
||||
hdf5main=${H5TOOL}_hdf5main.$suffix
|
||||
@@ -271,7 +272,9 @@ if test -z "$HDF5_NOCLEANUP"; then
|
||||
fi
|
||||
|
||||
if test $nerrors -eq 0 ; then
|
||||
echo "All $H5TOOL tests passed."
|
||||
echo "All $TESTNAME tests passed."
|
||||
exit $EXIT_SUCCESS
|
||||
else
|
||||
echo "$TESTNAME tests failed with $nerrors errors."
|
||||
exit $EXIT_FAILURE
|
||||
fi
|
||||
|
||||
exit $nerrors
|
||||
|
||||
125
c++/src/CMakeLists.txt
Normal file
125
c++/src/CMakeLists.txt
Normal file
@@ -0,0 +1,125 @@
|
||||
cmake_minimum_required (VERSION 3.1.0)
|
||||
PROJECT (HDF5_CPP_SRC)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Shared/Static Libs
|
||||
#-----------------------------------------------------------------------------
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (CPP_BUILT_AS_DYNAMIC_LIB 1)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generate configure file
|
||||
#-----------------------------------------------------------------------------
|
||||
configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in
|
||||
${HDF5_BINARY_DIR}/H5cxx_pubconf.h
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Define cpp Library
|
||||
#-----------------------------------------------------------------------------
|
||||
set (CPP_SRCS
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5CommonFG.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5CompType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSet.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSpace.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DataType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DcreatProp.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DxferProp.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5EnumType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Exception.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5FaccProp.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5FcreatProp.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5File.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5FloatType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Group.cpp
|
||||
${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
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.cpp
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.cpp
|
||||
)
|
||||
|
||||
set (CPP_HDRS
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Alltypes.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Attribute.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Classes.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5CommonFG.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5CompType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Cpp.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5CppDoc.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSet.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DataSpace.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DataType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DcreatProp.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5DxferProp.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5EnumType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Exception.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5FaccProp.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5FcreatProp.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5File.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5FloatType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5Group.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5IdComponent.h
|
||||
${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
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5StrType.h
|
||||
${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h
|
||||
)
|
||||
|
||||
add_library (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS})
|
||||
TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} " " " ")
|
||||
target_link_libraries (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
|
||||
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
|
||||
H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} ${LIB_TYPE})
|
||||
set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES
|
||||
FOLDER libraries/cpp
|
||||
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add file(s) to CMake Install
|
||||
#-----------------------------------------------------------------------------
|
||||
install (
|
||||
FILES
|
||||
${CPP_HDRS}
|
||||
DESTINATION
|
||||
${HDF5_INSTALL_INCLUDE_DIR}
|
||||
COMPONENT
|
||||
cppheaders
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add Target(s) to CMake Install for import into other projects
|
||||
#-----------------------------------------------------------------------------
|
||||
if (HDF5_EXPORTED_TARGETS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
install (
|
||||
TARGETS
|
||||
${HDF5_CPP_LIB_TARGET}
|
||||
EXPORT
|
||||
${HDF5_EXPORTED_TARGETS}
|
||||
LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT cpplibraries
|
||||
ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT cpplibraries
|
||||
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT cpplibraries
|
||||
)
|
||||
endif (HDF5_EXPORTED_TARGETS)
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "H5PropList.h"
|
||||
#include "H5Object.h"
|
||||
#include "H5AbstractDs.h"
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5DcreatProp.h"
|
||||
#include "H5CommonFG.h"
|
||||
#include "H5Alltypes.h"
|
||||
@@ -40,6 +41,12 @@ AbstractDs::AbstractDs(){}
|
||||
// Function: AbstractDs default constructor
|
||||
///\brief Creates an AbstractDs instance using an existing id.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//
|
||||
// *** Deprecation warning ***
|
||||
// This constructor is no longer appropriate because the data member "id" had
|
||||
// been moved to the sub-classes. It will be removed in 1.10 release. If its
|
||||
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
|
||||
// subsequent releases.
|
||||
//--------------------------------------------------------------------------
|
||||
AbstractDs::AbstractDs(const hid_t ds_id){}
|
||||
|
||||
@@ -47,8 +54,13 @@ AbstractDs::AbstractDs(const hid_t ds_id){}
|
||||
// Function: AbstractDs copy constructor
|
||||
///\brief Copy constructor: makes a copy of the original AbstractDs object.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// *** Deprecation warning ***
|
||||
// This constructor is no longer appropriate because the data member "id" had
|
||||
// been moved to the sub-classes. It is removed from 1.8.15 because it is
|
||||
// a noop and it can be generated by the compiler if needed.
|
||||
//--------------------------------------------------------------------------
|
||||
AbstractDs::AbstractDs(const AbstractDs& original){}
|
||||
//--------------------------------------------------------------------------
|
||||
// AbstractDs::AbstractDs(const AbstractDs& original){}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: AbstractDs::getTypeClass
|
||||
@@ -76,15 +88,26 @@ H5T_class_t AbstractDs::getTypeClass() const
|
||||
|
||||
// Gets the class of the datatype and validate it before returning
|
||||
H5T_class_t type_class = H5Tget_class(datatype_id);
|
||||
if( type_class != H5T_NO_CLASS )
|
||||
return( type_class );
|
||||
else
|
||||
|
||||
// Close temporary datatype_id
|
||||
herr_t ret_value = H5Tclose(datatype_id);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
if (fromClass() == "DataSet")
|
||||
throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
|
||||
else if (fromClass() == "Attribute")
|
||||
throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed");
|
||||
}
|
||||
|
||||
// Check on the returned type_class
|
||||
if (type_class == H5T_NO_CLASS)
|
||||
{
|
||||
if (fromClass() == "DataSet")
|
||||
throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
|
||||
else if (fromClass() == "Attribute")
|
||||
throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
|
||||
}
|
||||
return(type_class);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -102,8 +125,9 @@ DataType AbstractDs::getDataType() const
|
||||
// depending on which object invokes getDataType. Then, create and
|
||||
// return the DataType object
|
||||
try {
|
||||
DataType datatype(p_get_type());
|
||||
return(datatype);
|
||||
DataType datatype;
|
||||
f_DataType_setId(&datatype, p_get_type());
|
||||
return(datatype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
|
||||
@@ -128,8 +152,9 @@ ArrayType AbstractDs::getArrayType() const
|
||||
// depending on which object invokes getArrayType. Then, create and
|
||||
// return the ArrayType object
|
||||
try {
|
||||
ArrayType arraytype(p_get_type());
|
||||
return(arraytype);
|
||||
ArrayType arraytype;
|
||||
f_DataType_setId(&arraytype, p_get_type());
|
||||
return(arraytype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
|
||||
@@ -154,8 +179,9 @@ CompType AbstractDs::getCompType() const
|
||||
// depending on which object invokes getCompType. Then, create and
|
||||
// return the CompType object
|
||||
try {
|
||||
CompType comptype(p_get_type());
|
||||
return(comptype);
|
||||
CompType comptype;
|
||||
f_DataType_setId(&comptype, p_get_type());
|
||||
return(comptype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
|
||||
@@ -180,8 +206,9 @@ EnumType AbstractDs::getEnumType() const
|
||||
// depending on which object invokes getEnumType. Then, create and
|
||||
// return the EnumType object
|
||||
try {
|
||||
EnumType enumtype(p_get_type());
|
||||
return(enumtype);
|
||||
EnumType enumtype;
|
||||
f_DataType_setId(&enumtype, p_get_type());
|
||||
return(enumtype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
|
||||
@@ -206,8 +233,9 @@ IntType AbstractDs::getIntType() const
|
||||
// depending on which object invokes getIntType. Then, create and
|
||||
// return the IntType object
|
||||
try {
|
||||
IntType inttype(p_get_type());
|
||||
return(inttype);
|
||||
IntType inttype;
|
||||
f_DataType_setId(&inttype, p_get_type());
|
||||
return(inttype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
|
||||
@@ -232,8 +260,9 @@ FloatType AbstractDs::getFloatType() const
|
||||
// depending on which object invokes getFloatType. Then, create and
|
||||
// return the FloatType object
|
||||
try {
|
||||
FloatType floatype(p_get_type());
|
||||
return(floatype);
|
||||
FloatType floatype;
|
||||
f_DataType_setId(&floatype, p_get_type());
|
||||
return(floatype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
|
||||
@@ -258,8 +287,9 @@ StrType AbstractDs::getStrType() const
|
||||
// depending on which object invokes getStrType. Then, create and
|
||||
// return the StrType object
|
||||
try {
|
||||
StrType strtype(p_get_type());
|
||||
return(strtype);
|
||||
StrType strtype;
|
||||
f_DataType_setId(&strtype, p_get_type());
|
||||
return(strtype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
|
||||
@@ -284,8 +314,9 @@ VarLenType AbstractDs::getVarLenType() const
|
||||
// depending on which object invokes getVarLenType. Then, create and
|
||||
// return the VarLenType object
|
||||
try {
|
||||
VarLenType varlentype(p_get_type());
|
||||
return(varlentype);
|
||||
VarLenType varlentype;
|
||||
f_DataType_setId(&varlentype, p_get_type());
|
||||
return(varlentype);
|
||||
}
|
||||
catch (DataSetIException E) {
|
||||
throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
|
||||
|
||||
@@ -14,13 +14,8 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class AbstractDs is an abstract base class, from which Attribute and
|
||||
// DataSet inherit. It provides the services that are common to both
|
||||
// Attribute and DataSet. It also inherits from H5Object and passes down
|
||||
// the services that H5Object provides.
|
||||
|
||||
#ifndef _AbstractDs_H
|
||||
#define _AbstractDs_H
|
||||
#ifndef __AbstractDs_H
|
||||
#define __AbstractDs_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
@@ -33,6 +28,15 @@ class FloatType;
|
||||
class IntType;
|
||||
class StrType;
|
||||
class VarLenType;
|
||||
class DataSpace;
|
||||
|
||||
/*! \class AbstractDs
|
||||
\brief AbstractDs is an abstract base class, inherited by Attribute
|
||||
and DataSet.
|
||||
|
||||
It provides a collection of services that are common to both Attribute
|
||||
and DataSet. AbstractDs inherits from H5Object.
|
||||
*/
|
||||
class H5_DLLCPP AbstractDs {
|
||||
public:
|
||||
// Gets a copy the datatype of that this abstract dataset uses.
|
||||
@@ -51,23 +55,22 @@ class H5_DLLCPP AbstractDs {
|
||||
StrType getStrType() const;
|
||||
VarLenType getVarLenType() const;
|
||||
|
||||
// Gets the dataspace of this abstract dataset - pure virtual.
|
||||
///\brief Gets the size in memory of this abstract dataset.
|
||||
virtual size_t getInMemDataSize() const = 0;
|
||||
|
||||
///\brief Gets the dataspace of this abstract dataset - pure virtual.
|
||||
virtual DataSpace getSpace() const = 0;
|
||||
|
||||
// Gets the class of the datatype that is used by this abstract
|
||||
// dataset.
|
||||
H5T_class_t getTypeClass() const;
|
||||
|
||||
// Returns the amount of storage size required for this abstract
|
||||
// dataset - pure virtual.
|
||||
///\brief Returns the amount of storage size required - 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
|
||||
AbstractDs( const AbstractDs& original );
|
||||
|
||||
// Destructor
|
||||
virtual ~AbstractDs();
|
||||
|
||||
@@ -75,8 +78,17 @@ class H5_DLLCPP AbstractDs {
|
||||
// Default constructor
|
||||
AbstractDs();
|
||||
|
||||
// Constructor that takes an attribute id or a dataset id.
|
||||
AbstractDs( const hid_t ds_id );
|
||||
// *** Deprecation warning ***
|
||||
// The following two constructors are no longer appropriate after the
|
||||
// data member "id" had been moved to the sub-classes.
|
||||
// The copy constructor is a noop and is removed in 1.8.15 and the
|
||||
// other will be removed from 1.10 release, and then from 1.8 if its
|
||||
// removal does not raise any problems in two 1.10 releases.
|
||||
|
||||
AbstractDs(const hid_t h5_id);
|
||||
|
||||
// Copy constructor
|
||||
// AbstractDs( const AbstractDs& original );
|
||||
|
||||
private:
|
||||
// This member function is implemented by DataSet and Attribute.
|
||||
@@ -85,4 +97,4 @@ class H5_DLLCPP AbstractDs {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif // _AbstractDs_H
|
||||
#endif // __AbstractDs_H
|
||||
|
||||
@@ -54,15 +54,16 @@ ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id )
|
||||
rank = H5Tget_array_ndims(existing_id);
|
||||
if (rank < 0)
|
||||
{
|
||||
throw DataTypeIException("ArrayType overloaded constructor", "H5Tget_array_ndims failed");
|
||||
throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_ndims failed");
|
||||
}
|
||||
|
||||
// Get the dimensions of the existing array and store it in this array
|
||||
dimensions = new hsize_t[rank];
|
||||
//hsize_t rdims2[H5S_MAX_RANK];
|
||||
int ret_value = H5Tget_array_dims2(id, dimensions);
|
||||
if (ret_value < 0)
|
||||
throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
|
||||
// Allocate space for the dimensions
|
||||
dimensions = new hsize_t[rank];
|
||||
|
||||
// Get the dimensions of the existing array and store it in this array
|
||||
int ret_value = H5Tget_array_dims2(id, dimensions);
|
||||
if (ret_value < 0)
|
||||
throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_dims2 failed");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -72,10 +73,13 @@ ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id )
|
||||
//--------------------------------------------------------------------------
|
||||
ArrayType::ArrayType( const ArrayType& original ) : DataType( original )
|
||||
{
|
||||
rank = original.rank;
|
||||
dimensions = new hsize_t[rank];
|
||||
for (int i = 0; i < rank; i++)
|
||||
dimensions[i] = original.dimensions[i];
|
||||
// Copy the rank of the original array
|
||||
rank = original.rank;
|
||||
|
||||
// Allocate space then copy the dimensions from the original array
|
||||
dimensions = new hsize_t[rank];
|
||||
for (int i = 0; i < rank; i++)
|
||||
dimensions[i] = original.dimensions[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -90,14 +94,19 @@ ArrayType::ArrayType( const ArrayType& original ) : DataType( original )
|
||||
//--------------------------------------------------------------------------
|
||||
ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType()
|
||||
{
|
||||
hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims);
|
||||
if (new_type_id < 0)
|
||||
throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed");
|
||||
id = new_type_id;
|
||||
rank = ndims;
|
||||
dimensions = new hsize_t[rank];
|
||||
for (int i = 0; i < rank; i++)
|
||||
dimensions[i] = dims[i];
|
||||
// Call C API to create an array data type
|
||||
hid_t new_type_id = H5Tarray_create2(base_type.getId(), ndims, dims);
|
||||
if (new_type_id < 0)
|
||||
throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed");
|
||||
|
||||
// Set the id and rank for this object
|
||||
id = new_type_id;
|
||||
rank = ndims;
|
||||
|
||||
// Allocate space then set the dimensions as provided by caller
|
||||
dimensions = new hsize_t[rank];
|
||||
for (int i = 0; i < rank; i++)
|
||||
dimensions[i] = dims[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -132,19 +141,19 @@ int ArrayType::getArrayNDims()
|
||||
//--------------------------------------------------------------------------
|
||||
int ArrayType::getArrayDims(hsize_t* dims)
|
||||
{
|
||||
// if the array's dimensions have not been stored, retrieve them via C API
|
||||
// If the array's dimensions have not been stored, retrieve them via C API
|
||||
if (dimensions == NULL)
|
||||
{
|
||||
int ndims = H5Tget_array_dims2(id, dims);
|
||||
if (ndims < 0)
|
||||
throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed");
|
||||
// store the array's info in memory
|
||||
// Store the array's info in memory
|
||||
rank = ndims;
|
||||
dimensions = new hsize_t[rank];
|
||||
for (int i = 0; i < rank; i++)
|
||||
dimensions[i] = dims[i];
|
||||
}
|
||||
// otherwise, simply copy what's in 'dimensions' to 'dims'
|
||||
// Otherwise, simply copy what's in 'dimensions' to 'dims'
|
||||
for (int i = 0; i < rank; i++)
|
||||
dims[i] = dimensions[i];
|
||||
return(rank);
|
||||
|
||||
@@ -14,16 +14,17 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class ArrayType inherits from DataType and provides wrappers for the
|
||||
// HDF5 C's Array Datatypes.
|
||||
|
||||
#ifndef _H5ArrayType_H
|
||||
#define _H5ArrayType_H
|
||||
#ifndef __H5ArrayType_H
|
||||
#define __H5ArrayType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class ArrayType
|
||||
\brief Class ArrayType inherits from DataType and provides wrappers for
|
||||
the HDF5's Array Datatypes.
|
||||
*/
|
||||
class H5_DLLCPP ArrayType : public DataType {
|
||||
public:
|
||||
// Constructor that creates a new array data type based on the
|
||||
@@ -36,7 +37,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.
|
||||
@@ -48,7 +49,6 @@ class H5_DLLCPP ArrayType : public DataType {
|
||||
// Noop destructor
|
||||
virtual ~ArrayType();
|
||||
|
||||
protected:
|
||||
// Default constructor
|
||||
ArrayType();
|
||||
|
||||
@@ -59,4 +59,4 @@ class H5_DLLCPP ArrayType : public DataType {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5ArrayType_H
|
||||
|
||||
@@ -45,7 +45,6 @@ AtomType::AtomType() : DataType() {}
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: AtomType copy constructor
|
||||
@@ -53,6 +52,7 @@ AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {}
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
AtomType::AtomType( const AtomType& original ) : DataType( original ) {}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: AtomType::setSize
|
||||
@@ -98,7 +98,7 @@ H5T_order_t AtomType::getOrder() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: AtomType::getOrder
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes a reference to a \c std::string for the buffer that
|
||||
/// It takes a reference to a \c H5std_string for the buffer that
|
||||
/// provide the text description of the returned byte order.
|
||||
/// The text description can be either of the following:
|
||||
/// "Little endian byte ordering (0)";
|
||||
@@ -178,7 +178,7 @@ size_t AtomType::getPrecision() const
|
||||
///\exception H5::DataTypeIException
|
||||
///\par Description
|
||||
/// For information, please see C layer Reference Manuat at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetPrecision
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void AtomType::setPrecision( size_t precision ) const
|
||||
@@ -198,7 +198,7 @@ void AtomType::setPrecision( size_t precision ) const
|
||||
///\exception H5::DataTypeIException
|
||||
///\par Description
|
||||
/// For information, please see C layer Reference Manuat at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-GetOffset
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetOffset
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// 12/05/00: due to C API change
|
||||
@@ -225,7 +225,7 @@ int AtomType::getOffset() const
|
||||
///\exception H5::DataTypeIException
|
||||
///\par Description
|
||||
/// For information, please see C layer Reference Manuat at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-SetOffset
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void AtomType::setOffset( size_t offset ) const
|
||||
@@ -285,12 +285,14 @@ void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: AtomType destructor
|
||||
///\brief Noop destructor.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
AtomType::~AtomType() {}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
|
||||
@@ -14,18 +14,20 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class AtomType is a base class, from which IntType, FloatType, StrType,
|
||||
// and PredType inherit. It provides the services that are common to these
|
||||
// subclasses. It also inherits from DataType and passes down the
|
||||
// services that are common to all the datatypes.
|
||||
|
||||
#ifndef _H5AtomType_H
|
||||
#define _H5AtomType_H
|
||||
#ifndef __H5AtomType_H
|
||||
#define __H5AtomType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class AtomType
|
||||
\brief AtomType is a base class, inherited by IntType, FloatType,
|
||||
StrType, and PredType.
|
||||
|
||||
AtomType provides operations on HDF5 atomic datatypes. It also inherits
|
||||
from DataType.
|
||||
*/
|
||||
class H5_DLLCPP AtomType : public DataType {
|
||||
public:
|
||||
// Returns the byte order of an atomic datatype.
|
||||
@@ -57,14 +59,16 @@ 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"); }
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Copy constructor - makes copy of the original object
|
||||
AtomType( const AtomType& original );
|
||||
|
||||
// Noop destructor
|
||||
virtual ~AtomType();
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
@@ -78,4 +82,4 @@ class H5_DLLCPP AtomType : public DataType {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5AtomType_H
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5File.h"
|
||||
#include "H5Attribute.h"
|
||||
#include "H5private.h" // for HDfree
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
@@ -43,12 +44,13 @@ namespace H5 {
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
class H5_DLLCPP H5Object; // forward declaration for UserData4Aiterate
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute default constructor
|
||||
///\brief Default constructor: Creates a stub attribute
|
||||
// Programmer Binh-Minh Ribler - May, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
Attribute::Attribute() : AbstractDs(), IdComponent(), id(0) {}
|
||||
Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute copy constructor
|
||||
@@ -72,7 +74,8 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent()
|
||||
//--------------------------------------------------------------------------
|
||||
Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent()
|
||||
{
|
||||
id = existing_id;
|
||||
id = existing_id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -95,23 +98,40 @@ void Attribute::write( const DataType& mem_type, const void *buf ) const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::write
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It writes a \a std::string to this attribute.
|
||||
/// It writes a \a H5std_string to this attribute.
|
||||
///\param mem_type - IN: Attribute datatype (in memory)
|
||||
///\param strg - IN: Data to be written
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - Apr, 2003
|
||||
//--------------------------------------------------------------------------
|
||||
void Attribute::write( const DataType& mem_type, const H5std_string& strg ) const
|
||||
void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
|
||||
{
|
||||
// Convert string to C-string
|
||||
const char* strg_C;
|
||||
strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
|
||||
// Check if this attribute has variable-len string or fixed-len string and
|
||||
// proceed appropriately.
|
||||
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
|
||||
if (is_variable_len < 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::write", "H5Tis_variable_str failed");
|
||||
}
|
||||
// Convert string to C-string
|
||||
const char* strg_C;
|
||||
strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
|
||||
herr_t ret_value = 0;
|
||||
|
||||
herr_t ret_value = H5Awrite( id, mem_type.getId(), &strg_C );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw AttributeIException("Attribute::write", "H5Awrite failed");
|
||||
}
|
||||
// Pass string in differently depends on variable or fixed length
|
||||
if (!is_variable_len)
|
||||
{
|
||||
ret_value = H5Awrite(id, mem_type.getId(), strg_C);
|
||||
}
|
||||
else
|
||||
{
|
||||
// passing third argument by address
|
||||
ret_value = H5Awrite(id, mem_type.getId(), &strg_C);
|
||||
}
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::write", "H5Awrite failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -127,14 +147,14 @@ void Attribute::read( const DataType& mem_type, void *buf ) const
|
||||
herr_t ret_value = H5Aread( id, mem_type.getId(), buf );
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw AttributeIException("Attribute::read", "H5Aread failed");
|
||||
throw AttributeIException("Attribute::read", "H5Aread failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::read
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It reads a \a std::string from this attribute.
|
||||
/// It reads a \a H5std_string from this attribute.
|
||||
///\param mem_type - IN: Attribute datatype (in memory)
|
||||
///\param strg - IN: Buffer for read string
|
||||
///\exception H5::AttributeIException
|
||||
@@ -143,33 +163,97 @@ void Attribute::read( const DataType& mem_type, void *buf ) const
|
||||
// Mar 2008
|
||||
// Corrected a misunderstanding that H5Aread would allocate
|
||||
// space for the buffer. Obtained the attribute size and
|
||||
// allocated memory properly. - BMR
|
||||
// allocated memory properly. -BMR
|
||||
// Apr 2009
|
||||
// Used getInMemDataSize to get attribute data size. -BMR
|
||||
// Jul 2009
|
||||
// Divided into specific private functions for fixed- and
|
||||
// variable-len string data: p_read_fixed_len and
|
||||
// p_read_variable_len. This should improve readability. -BMR
|
||||
//--------------------------------------------------------------------------
|
||||
void Attribute::read( const DataType& mem_type, H5std_string& strg ) const
|
||||
void Attribute::read(const DataType& mem_type, H5std_string& strg) const
|
||||
{
|
||||
// Get the attribute size and allocate temporary C-string for C API
|
||||
hsize_t attr_size = H5Aget_storage_size(id);
|
||||
if (attr_size <= 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::read", "Unable to get attribute size before reading");
|
||||
}
|
||||
char* strg_C = new char [(size_t)attr_size+1];
|
||||
if (strg_C == NULL)
|
||||
{
|
||||
throw AttributeIException("Attribute::read", "Unable to allocate buffer to read the attribute");
|
||||
}
|
||||
// Check if this attribute has variable-len string or fixed-len string and
|
||||
// proceed appropriately.
|
||||
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
|
||||
if (is_variable_len < 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::read", "H5Tis_variable_str failed");
|
||||
}
|
||||
|
||||
// Call C API to get the attribute data, a string of chars
|
||||
herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw AttributeIException("Attribute::read", "H5Aread failed");
|
||||
}
|
||||
if (!is_variable_len) // only allocate for fixed-len string
|
||||
{
|
||||
p_read_fixed_len(mem_type, strg);
|
||||
}
|
||||
else
|
||||
{
|
||||
p_read_variable_len(mem_type, strg);
|
||||
}
|
||||
}
|
||||
|
||||
// Get 'string' from the C char* and release resource
|
||||
strg_C[attr_size] = '\0';
|
||||
strg = strg_C;
|
||||
delete []strg_C;
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getInMemDataSize
|
||||
///\brief Gets the size in memory of the attribute's data.
|
||||
///\return Size of data (in memory)
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - Apr 2009
|
||||
//--------------------------------------------------------------------------
|
||||
size_t Attribute::getInMemDataSize() const
|
||||
{
|
||||
const char *func = "Attribute::getInMemDataSize";
|
||||
|
||||
// Get the data type of this attribute
|
||||
hid_t mem_type_id = H5Aget_type(id);
|
||||
if( mem_type_id < 0 )
|
||||
{
|
||||
throw AttributeIException(func, "H5Aget_type failed");
|
||||
}
|
||||
|
||||
// Get the data type's size by first getting its native type then getting
|
||||
// the native type's size.
|
||||
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
|
||||
if (native_type < 0)
|
||||
{
|
||||
throw AttributeIException(func, "H5Tget_native_type failed");
|
||||
}
|
||||
size_t type_size = H5Tget_size(native_type);
|
||||
if (type_size == 0)
|
||||
{
|
||||
throw AttributeIException(func, "H5Tget_size failed");
|
||||
}
|
||||
|
||||
// Close the native type and the datatype of this attribute.
|
||||
if (H5Tclose(native_type) < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Tclose(native_type) failed");
|
||||
}
|
||||
if (H5Tclose(mem_type_id) < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
|
||||
}
|
||||
|
||||
// Get number of elements of the attribute by first getting its dataspace
|
||||
// then getting the number of elements in the dataspace
|
||||
hid_t space_id = H5Aget_space(id);
|
||||
if (space_id < 0)
|
||||
{
|
||||
throw AttributeIException(func, "H5Aget_space failed");
|
||||
}
|
||||
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
|
||||
if (num_elements < 0)
|
||||
{
|
||||
throw AttributeIException(func, "H5Sget_simple_extent_npoints failed");
|
||||
}
|
||||
|
||||
// Close the dataspace
|
||||
if (H5Sclose(space_id) < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Sclose failed");
|
||||
}
|
||||
|
||||
// Calculate and return the size of the data
|
||||
size_t data_size = type_size * num_elements;
|
||||
return(data_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -187,8 +271,9 @@ DataSpace Attribute::getSpace() const
|
||||
// If the dataspace id is valid, create and return the DataSpace object
|
||||
if( dataspace_id > 0 )
|
||||
{
|
||||
DataSpace dataspace( dataspace_id );
|
||||
return( dataspace );
|
||||
DataSpace dataspace;
|
||||
f_DataSpace_setId(&dataspace, dataspace_id);
|
||||
return(dataspace);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -196,26 +281,6 @@ DataSpace Attribute::getSpace() const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::p_get_type (private)
|
||||
// Purpose Gets the datatype of this attribute.
|
||||
// Return Id of the datatype
|
||||
// Exception H5::AttributeIException
|
||||
// Description
|
||||
// This private function is used in AbstractDs.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
hid_t Attribute::p_get_type() const
|
||||
{
|
||||
hid_t type_id = H5Aget_type( id );
|
||||
if( type_id > 0 )
|
||||
return( type_id );
|
||||
else
|
||||
{
|
||||
throw AttributeIException("", "H5Aget_type failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getFileName
|
||||
///\brief Gets the name of the file, in which this attribute belongs.
|
||||
@@ -236,75 +301,171 @@ H5std_string Attribute::getFileName() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getName
|
||||
///\brief Gets the name of this attribute, returning its length.
|
||||
///\param buf_size - IN: Desired length of the name
|
||||
///\param attr_name - OUT: Buffer for the name string
|
||||
///\return Length of the attribute name
|
||||
///\param attr_name - OUT: Buffer for the name string as char*
|
||||
///\param buf_size - IN: Length of the buffer, default to 0
|
||||
///\return Actual length of the attribute name
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - Nov, 2001
|
||||
///\par Description
|
||||
/// This function retrieves \a buf_size chars of the attribute's
|
||||
/// name including null termination. Thus, if the actual length
|
||||
/// of the name is more than buf_size-1, the retrieved name will
|
||||
/// be truncated to accommodate the null terminator.
|
||||
/// To get length of the attribute's name for buffer allocation,
|
||||
/// an application can call this function passing in NULL for the
|
||||
/// first argument and ignore the second argument.
|
||||
// Programmer Binh-Minh Ribler - Mar, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
ssize_t Attribute::getName( size_t buf_size, H5std_string& attr_name ) const
|
||||
ssize_t Attribute::getName(char* attr_name, size_t buf_size) const
|
||||
{
|
||||
char* name_C = new char[buf_size+1]; // temporary C-string for C API
|
||||
// H5Aget_name will get buf_size-1 chars of the name to null terminate it
|
||||
ssize_t name_size = H5Aget_name(id, buf_size, attr_name);
|
||||
|
||||
// Calls C routine H5Aget_name to get the name of the attribute
|
||||
ssize_t name_size = H5Aget_name( id, buf_size, name_C );
|
||||
|
||||
// If H5Aget_name returns a negative value, raise an exception,
|
||||
if( name_size < 0 )
|
||||
{
|
||||
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
|
||||
}
|
||||
// otherwise, convert the C attribute name and return
|
||||
attr_name = name_C;
|
||||
delete []name_C;
|
||||
return( name_size );
|
||||
// If H5Aget_name returns a negative value, raise an exception
|
||||
if (name_size < 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
|
||||
}
|
||||
else if (name_size == 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
|
||||
}
|
||||
// Return length of the name
|
||||
return(name_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getName
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function in that it returns the
|
||||
/// attribute's name, not the length.
|
||||
///\return Name of the attribute
|
||||
///\param buf_size - IN: Desired length of the name
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string Attribute::getName( size_t buf_size ) const
|
||||
{
|
||||
H5std_string attr_name;
|
||||
ssize_t name_size = getName( buf_size, attr_name );
|
||||
return( attr_name );
|
||||
// let caller catch exception if any
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getName
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above functions in that it doesn't take
|
||||
/// any arguments and returns the attribute's name.
|
||||
///\brief Returns the name of this attribute as an \a H5std_string.
|
||||
///\return Name of the attribute
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - May, 2004
|
||||
// Modification
|
||||
// Mar 2014 - BMR
|
||||
// Revised to use the modified getName() above
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string Attribute::getName() const
|
||||
{
|
||||
// Try with 256 characters for the name first, if the name's length
|
||||
// returned is more than that then, read the name again with the
|
||||
// appropriate space allocation
|
||||
char* name_C = new char[256]; // temporary C-string for C API
|
||||
ssize_t name_size = H5Aget_name(id, 255, name_C);
|
||||
H5std_string attr_name(""); // attribute name to return
|
||||
|
||||
H5std_string attr_name;
|
||||
if (name_size >= 256)
|
||||
name_size = getName(name_size, attr_name);
|
||||
// Preliminary call to get the size of the attribute name
|
||||
ssize_t name_size = H5Aget_name(id, (size_t)0, NULL);
|
||||
|
||||
// otherwise, convert the C attribute name and return
|
||||
else
|
||||
attr_name = name_C;
|
||||
// If H5Aget_name failed, throw exception
|
||||
if (name_size < 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::getName", "H5Aget_name failed");
|
||||
}
|
||||
else if (name_size == 0)
|
||||
{
|
||||
throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0");
|
||||
}
|
||||
// Attribute's name exists, retrieve it
|
||||
else if (name_size > 0)
|
||||
{
|
||||
char* name_C = new char[name_size+1]; // temporary C-string
|
||||
HDmemset(name_C, 0, name_size+1); // clear buffer
|
||||
|
||||
delete []name_C;
|
||||
return( attr_name );
|
||||
// Use overloaded function
|
||||
name_size = getName(name_C, name_size+1);
|
||||
|
||||
// Convert the C attribute name to return
|
||||
attr_name = name_C;
|
||||
|
||||
// Clean up resource
|
||||
delete []name_C;
|
||||
|
||||
}
|
||||
// Return attribute's name
|
||||
return(attr_name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getName
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function in that it takes an integer
|
||||
/// specifying a desired length to be retrieved of the name.
|
||||
///\return Name (or part of name) of the attribute
|
||||
///\param len - IN: Desired length of the name
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// Mar 2014 - BMR
|
||||
// Revised to use the new getName() below
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string Attribute::getName(size_t len) const
|
||||
{
|
||||
H5std_string attr_name;
|
||||
ssize_t name_size = getName(attr_name, len);
|
||||
if (name_size < 0)
|
||||
return("");
|
||||
else
|
||||
return(attr_name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getName
|
||||
///\brief Gets the name of this attribute, returning its length.
|
||||
///\param attr_name - OUT: Buffer for the name string as \a H5std_string
|
||||
///\param len - IN: Desired length of the name, default to 0
|
||||
///\return Actual length of the attribute name
|
||||
///\exception H5::AttributeIException
|
||||
///\par Description
|
||||
/// This function retrieves the attribute's name as a string. The
|
||||
/// buf_size can specify a specific length or default to 0, in
|
||||
/// which case the entire name will be retrieved.
|
||||
// Programmer Binh-Minh Ribler - Nov, 2001
|
||||
// Modification
|
||||
// Mar 2014 - BMR
|
||||
// Added to replace getName(size_t, H5std_string&) so that it'll
|
||||
// allow the argument "len" to be skipped.
|
||||
//--------------------------------------------------------------------------
|
||||
ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const
|
||||
{
|
||||
ssize_t name_size = 0;
|
||||
|
||||
// If no length is provided, get the entire attribute name
|
||||
if (len == 0)
|
||||
{
|
||||
attr_name = getName();
|
||||
name_size = attr_name.length();
|
||||
}
|
||||
// If length is provided, get that number of characters in name
|
||||
else
|
||||
{
|
||||
char* name_C = new char[len+1]; // temporary C-string
|
||||
HDmemset(name_C, 0, len+1); // clear buffer
|
||||
|
||||
// Use overloaded function
|
||||
name_size = getName(name_C, len+1);
|
||||
|
||||
// Convert the C attribute name to return
|
||||
attr_name = name_C;
|
||||
|
||||
// Clean up resource
|
||||
delete []name_C;
|
||||
}
|
||||
// Otherwise, keep attr_name intact
|
||||
|
||||
// Return name size
|
||||
return(name_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::getName
|
||||
///\brief This function is replaced by the previous function, which
|
||||
/// provides more convenient prototype. It will be removed
|
||||
/// in future release.
|
||||
///\param len - IN: Desired length of the name
|
||||
///\param attr_name - OUT: Buffer for the name string
|
||||
///\return Actual length of the attribute name
|
||||
///\exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - Nov, 2001
|
||||
// Modification
|
||||
// Modified to call its replacement. -BMR, 2014/04/16
|
||||
//--------------------------------------------------------------------------
|
||||
ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const
|
||||
{
|
||||
return (getName(attr_name, len));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -322,9 +483,35 @@ 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
|
||||
///\brief Get the id of this attribute
|
||||
///\return Attribute identifier
|
||||
// Description:
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
// AbstractDS and Attribute are moved out of H5Object. In
|
||||
@@ -337,30 +524,118 @@ hid_t Attribute::getId() const
|
||||
return(id);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::p_get_type (private)
|
||||
// Purpose Gets the datatype of this attribute.
|
||||
// Return Id of the datatype
|
||||
// Exception H5::AttributeIException
|
||||
// Description
|
||||
// This private function is used in AbstractDs.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
hid_t Attribute::p_get_type() const
|
||||
{
|
||||
hid_t type_id = H5Aget_type( id );
|
||||
if( type_id > 0 )
|
||||
return( type_id );
|
||||
else
|
||||
{
|
||||
throw AttributeIException("", "H5Aget_type failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::p_read_fixed_len (private)
|
||||
// brief Reads a fixed length \a H5std_string from an attribute.
|
||||
// param mem_type - IN: Attribute datatype (in memory)
|
||||
// param strg - IN: Buffer for read string
|
||||
// exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - Jul, 2009
|
||||
// Modification
|
||||
// Jul 2009
|
||||
// Separated the fixed length case from the original
|
||||
// Attribute::read
|
||||
//--------------------------------------------------------------------------
|
||||
void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const
|
||||
{
|
||||
// Only allocate for fixed-len string.
|
||||
|
||||
// Get the size of the attribute's data
|
||||
size_t attr_size = getInMemDataSize();
|
||||
|
||||
// If there is data, allocate buffer and read it.
|
||||
if (attr_size > 0)
|
||||
{
|
||||
char *strg_C = new char[(size_t)attr_size+1];
|
||||
herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
delete []strg_C; // de-allocate for fixed-len string
|
||||
throw AttributeIException("Attribute::read", "H5Aread failed");
|
||||
}
|
||||
// Get string from the C char* and release resource allocated locally
|
||||
strg_C[attr_size] = '\0';
|
||||
strg = strg_C;
|
||||
delete []strg_C;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::p_read_variable_len (private)
|
||||
// brief Reads a variable length \a H5std_string from an attribute.
|
||||
// param mem_type - IN: Attribute datatype (in memory)
|
||||
// param strg - IN: Buffer for read string
|
||||
// exception H5::AttributeIException
|
||||
// Programmer Binh-Minh Ribler - Jul, 2009
|
||||
// Modification
|
||||
// Jul 2009
|
||||
// Separated the variable length case from the original
|
||||
// Attribute::read. -BMR
|
||||
//--------------------------------------------------------------------------
|
||||
void Attribute::p_read_variable_len(const DataType& mem_type, H5std_string& strg) const
|
||||
{
|
||||
// Prepare and call C API to read attribute.
|
||||
char *strg_C;
|
||||
|
||||
// Read attribute, no allocation for variable-len string; C library will
|
||||
herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C);
|
||||
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw AttributeIException("Attribute::read", "H5Aread failed");
|
||||
}
|
||||
|
||||
// Get string from the C char* and release resource allocated by C API
|
||||
strg = strg_C;
|
||||
HDfree(strg_C);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::p_setId
|
||||
///\brief Sets the identifier of this object to a new value.
|
||||
///
|
||||
///\exception H5::IdComponentException when the attempt to close the HDF5
|
||||
/// object fails
|
||||
/// object fails
|
||||
// Description:
|
||||
// The underlaying reference counting in the C library ensures
|
||||
// that the current valid id of this object is properly closed.
|
||||
// Then the object's id is reset to the new id.
|
||||
// The underlaying reference counting in the C library ensures
|
||||
// that the current valid id of this object is properly closed.
|
||||
// Then the object's id is reset to the new id.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void Attribute::p_setId(const hid_t new_id)
|
||||
{
|
||||
// handling references to this old id
|
||||
try {
|
||||
close();
|
||||
close();
|
||||
}
|
||||
catch (Exception close_error) {
|
||||
throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg());
|
||||
throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg());
|
||||
}
|
||||
// reset object's id to the given id
|
||||
id = new_id;
|
||||
}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Attribute::close
|
||||
@@ -378,10 +653,8 @@ void Attribute::close()
|
||||
{
|
||||
throw AttributeIException("Attribute::close", "H5Aclose failed");
|
||||
}
|
||||
// reset the id when the attribute that it represents is no longer
|
||||
// referenced
|
||||
if (getCounter() == 0)
|
||||
id = 0;
|
||||
// reset the id
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,15 +14,33 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5Attribute_H
|
||||
#define _H5Attribute_H
|
||||
#ifndef __H5Attribute_H
|
||||
#define __H5Attribute_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class Attribute
|
||||
\brief Class Attribute operates on HDF5 attributes.
|
||||
|
||||
An attribute has many characteristics similar to a dataset, thus both
|
||||
Attribute and DataSet are derivatives of AbstractDs. Attribute also
|
||||
inherits from IdComponent because an attribute is an HDF5 component that
|
||||
is identified by an identifier.
|
||||
*/
|
||||
class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
|
||||
public:
|
||||
|
||||
// Copy constructor: makes a copy of an existing Attribute object.
|
||||
Attribute( const Attribute& original );
|
||||
|
||||
// Default constructor
|
||||
Attribute();
|
||||
|
||||
// Creates a copy of an existing attribute using the attribute id
|
||||
Attribute( const hid_t attr_id );
|
||||
|
||||
// Closes this attribute.
|
||||
virtual void close();
|
||||
|
||||
@@ -30,15 +48,22 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
|
||||
H5std_string getFileName() const;
|
||||
|
||||
// Gets the name of this attribute.
|
||||
ssize_t getName(char* attr_name, size_t buf_size = 0) const;
|
||||
H5std_string getName(size_t len) const;
|
||||
H5std_string getName() const;
|
||||
ssize_t getName(H5std_string& attr_name, size_t len = 0) const;
|
||||
// The overloaded function below is replaced by the one above and it
|
||||
// is kept for backward compatibility purpose.
|
||||
ssize_t getName( size_t buf_size, H5std_string& attr_name ) const;
|
||||
H5std_string getName( size_t buf_size ) const; // returns name, not its length
|
||||
H5std_string getName() const; // returns name, no argument
|
||||
|
||||
// Gets a copy of the dataspace for this attribute.
|
||||
virtual DataSpace getSpace() const;
|
||||
|
||||
// Returns the amount of storage size required for this attribute.
|
||||
hsize_t getStorageSize() const;
|
||||
virtual hsize_t getStorageSize() const;
|
||||
|
||||
// Returns the in memory size of this attribute's data.
|
||||
virtual size_t getInMemDataSize() const;
|
||||
|
||||
// Reads data from this attribute.
|
||||
void read( const DataType& mem_type, void *buf ) const;
|
||||
@@ -48,18 +73,13 @@ 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
|
||||
Attribute( const hid_t attr_id );
|
||||
|
||||
// Copy constructor: makes a copy of an existing Attribute object.
|
||||
Attribute( const Attribute& original );
|
||||
|
||||
// Default constructor
|
||||
Attribute();
|
||||
|
||||
// Gets the attribute id.
|
||||
virtual hid_t getId() const;
|
||||
|
||||
@@ -67,8 +87,10 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
|
||||
virtual ~Attribute();
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Sets the attribute id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
hid_t id; // HDF5 attribute id
|
||||
@@ -79,13 +101,21 @@ class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
|
||||
// sub-types
|
||||
virtual hid_t p_get_type() const;
|
||||
|
||||
// Reads variable or fixed len strings from this attribute.
|
||||
void p_read_variable_len(const DataType& mem_type, H5std_string& strg) const;
|
||||
void p_read_fixed_len(const DataType& mem_type, H5std_string& strg) const;
|
||||
|
||||
// do not inherit H5Object::iterateAttrs
|
||||
int iterateAttrs() { return 0; }
|
||||
|
||||
// do not inherit H5Object::renameAttr
|
||||
void renameAttr() {}
|
||||
|
||||
// Friend function to set Attribute id. For library use only.
|
||||
friend void f_Attribute_setId(Attribute* attr, hid_t new_id);
|
||||
|
||||
};
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5Attribute_H
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5Classes_H
|
||||
#define _H5Classes_H
|
||||
#ifndef __H5Classes_H
|
||||
#define __H5Classes_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
class Exception;
|
||||
class IdComponent;
|
||||
class H5Location;
|
||||
class H5Object;
|
||||
class PropList;
|
||||
class FileCreatPropList;
|
||||
@@ -48,4 +49,4 @@ namespace H5 {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5Classes_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,21 +14,24 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// CommonFG is a protocol class. Its existence is simply to provide the
|
||||
// common services that are provided by H5File and Group. The file or
|
||||
// group in the context of this class is referred to as 'location'.
|
||||
|
||||
#ifndef _CommonFG_H
|
||||
#define _CommonFG_H
|
||||
#ifndef __CommonFG_H
|
||||
#define __CommonFG_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// Class forwarding
|
||||
class Group;
|
||||
class H5File;
|
||||
class ArrayType;
|
||||
class VarLenType;
|
||||
|
||||
/*! \class CommonFG
|
||||
\brief \a CommonFG is an abstract base class of H5File and H5Group.
|
||||
|
||||
It provides common operations of H5File and H5Group.
|
||||
*/
|
||||
class H5_DLLCPP CommonFG {
|
||||
public:
|
||||
// Creates a new group at this location which can be a file
|
||||
@@ -49,35 +52,35 @@ class H5_DLLCPP CommonFG {
|
||||
DataSet openDataSet(const char* name) const;
|
||||
DataSet openDataSet(const H5std_string& name) const;
|
||||
|
||||
// Retrieves comment for the HDF5 object specified by its name.
|
||||
H5std_string getComment(const H5std_string& name) const;
|
||||
H5std_string getComment(const char* name, size_t bufsize) const;
|
||||
H5std_string getComment(const H5std_string& name, size_t bufsize) const;
|
||||
|
||||
// Removes the comment for the HDF5 object specified by its name.
|
||||
void removeComment(const char* name) const;
|
||||
void removeComment(const H5std_string& name) const;
|
||||
|
||||
// Sets the comment for an HDF5 object specified by its name.
|
||||
void setComment(const char* name, const char* comment) const;
|
||||
void setComment(const H5std_string& name, const H5std_string& comment) const;
|
||||
|
||||
// Returns the name of the HDF5 object that the symbolic link points to.
|
||||
H5std_string getLinkval(const char* name, size_t size) const;
|
||||
H5std_string getLinkval(const H5std_string& name, size_t size) const;
|
||||
// Returns the value of a symbolic link.
|
||||
H5std_string getLinkval(const char* link_name, size_t size=0) const;
|
||||
H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
|
||||
|
||||
// Returns the number of objects in this group.
|
||||
hsize_t getNumObjs() const;
|
||||
|
||||
// Retrieves the name of an object in this group, given the
|
||||
// object's index.
|
||||
ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
|
||||
H5std_string getObjnameByIdx(hsize_t idx) const;
|
||||
ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
|
||||
ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
|
||||
|
||||
// Retrieves the type of an object in this file or group, given the
|
||||
// object's name
|
||||
H5O_type_t childObjType(const H5std_string& objname) const;
|
||||
H5O_type_t childObjType(const char* objname) const;
|
||||
H5O_type_t childObjType(hsize_t index, H5_index_t index_type=H5_INDEX_NAME, H5_iter_order_t order=H5_ITER_INC, const char* objname=".") const;
|
||||
|
||||
// Returns the object header version of an object in this file or group,
|
||||
// given the object's name.
|
||||
unsigned childObjVersion(const char* objname) const;
|
||||
unsigned childObjVersion(const H5std_string& objname) const;
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
// Returns the type of an object in this group, given the
|
||||
// object's index.
|
||||
H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
|
||||
H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
|
||||
H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
|
||||
|
||||
// Returns information about an HDF5 object, given by its name,
|
||||
@@ -103,8 +106,10 @@ class H5_DLLCPP CommonFG {
|
||||
void unlink(const H5std_string& name) const;
|
||||
|
||||
// Mounts the file 'child' onto this location.
|
||||
void mount(const char* name, H5File& child, PropList& plist) const;
|
||||
void mount(const H5std_string& name, H5File& child, PropList& plist) const;
|
||||
void mount(const char* name, const H5File& child, const PropList& plist) const;
|
||||
void mount(const char* name, H5File& child, PropList& plist) const; // backward compatibility
|
||||
void mount(const H5std_string& name, const H5File& child, const PropList& plist) const;
|
||||
void mount(const H5std_string& name, H5File& child, PropList& plist) const; // backward compatibility
|
||||
|
||||
// Unmounts the file named 'name' from this parent location.
|
||||
void unmount(const char* name) const;
|
||||
@@ -151,7 +156,6 @@ class H5_DLLCPP CommonFG {
|
||||
/// object id, i.e. file or group id.
|
||||
virtual hid_t getLocId() const = 0;
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
/// For subclasses, H5File and Group, to throw appropriate exception.
|
||||
virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;
|
||||
@@ -162,10 +166,15 @@ class H5_DLLCPP CommonFG {
|
||||
// Noop destructor.
|
||||
virtual ~CommonFG();
|
||||
|
||||
protected:
|
||||
virtual void p_setId(const hid_t new_id) = 0;
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
}; // end of CommonFG declaration
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __CommonFG_H
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ H5std_string CompType::getMemberName( unsigned member_num ) const
|
||||
"H5Tget_member_name returns NULL for member name");
|
||||
}
|
||||
H5std_string member_name = H5std_string(member_name_C); // convert C string to string
|
||||
HDfree(member_name_C); // free the C string
|
||||
H5free_memory(member_name_C); // free the C string
|
||||
return( member_name ); // return the member name string
|
||||
}
|
||||
|
||||
@@ -227,7 +227,8 @@ hid_t CompType::p_get_member_type(unsigned member_num) const
|
||||
DataType CompType::getMemberDataType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
DataType datatype(p_get_member_type(member_num));
|
||||
DataType datatype;
|
||||
f_DataType_setId(&datatype, p_get_member_type(member_num));
|
||||
return(datatype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -248,6 +249,7 @@ ArrayType CompType::getMemberArrayType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
ArrayType arraytype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&arraytype, p_get_member_type(member_num));
|
||||
return(arraytype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -268,6 +270,7 @@ CompType CompType::getMemberCompType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
CompType comptype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&comptype, p_get_member_type(member_num));
|
||||
return(comptype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -288,6 +291,7 @@ EnumType CompType::getMemberEnumType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
EnumType enumtype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&enumtype, p_get_member_type(member_num));
|
||||
return(enumtype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -308,6 +312,7 @@ IntType CompType::getMemberIntType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
IntType inttype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&inttype, p_get_member_type(member_num));
|
||||
return(inttype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -328,6 +333,7 @@ FloatType CompType::getMemberFloatType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
FloatType floatype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&floatype, p_get_member_type(member_num));
|
||||
return(floatype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -348,6 +354,7 @@ StrType CompType::getMemberStrType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
StrType strtype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&strtype, p_get_member_type(member_num));
|
||||
return(strtype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -368,6 +375,7 @@ VarLenType CompType::getMemberVarLenType( unsigned member_num ) const
|
||||
{
|
||||
try {
|
||||
VarLenType varlentype(p_get_member_type(member_num));
|
||||
f_DataType_setId(&varlentype, p_get_member_type(member_num));
|
||||
return(varlentype);
|
||||
}
|
||||
catch (DataTypeIException E) {
|
||||
@@ -450,6 +458,25 @@ void CompType::pack() const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: CompType::setSize
|
||||
///\brief Sets the total size for this compound datatype.
|
||||
///\param size - IN: Size to set
|
||||
///\exception H5::DataTypeIException
|
||||
// Note
|
||||
// H5Tset_size works on atom datatypes and compound datatypes only
|
||||
// Programmer Binh-Minh Ribler - 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void CompType::setSize(size_t size) const
|
||||
{
|
||||
// Call C routine H5Tset_size to set the total size
|
||||
herr_t ret_value = H5Tset_size(id, size);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw DataTypeIException("CompType::setSize", "H5Tset_size failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: CompType destructor
|
||||
///\brief Properly terminates access to this compound datatype.
|
||||
|
||||
@@ -14,24 +14,34 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class CompType inherits from DataType and provides accesses to a compound
|
||||
// datatype.
|
||||
|
||||
#ifndef _H5CompType_H
|
||||
#define _H5CompType_H
|
||||
#ifndef __H5CompType_H
|
||||
#define __H5CompType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class CompType
|
||||
\brief CompType is a derivative of a DataType and operates on HDF5
|
||||
compound datatypes.
|
||||
*/
|
||||
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 +98,12 @@ class H5_DLLCPP CompType : public DataType {
|
||||
// Recursively removes padding from within this compound datatype.
|
||||
void pack() const;
|
||||
|
||||
// Returns this class name
|
||||
// Sets the total size for this compound datatype.
|
||||
void setSize(size_t size) const;
|
||||
|
||||
///\brief Returns this class name.
|
||||
virtual H5std_string fromClass () const { return("CompType"); }
|
||||
|
||||
// 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();
|
||||
|
||||
@@ -111,4 +115,4 @@ class H5_DLLCPP CompType : public DataType {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5CompType_H
|
||||
|
||||
@@ -14,14 +14,15 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5CPP_H
|
||||
#define _H5CPP_H
|
||||
#ifndef __H5Cpp_H
|
||||
#define __H5Cpp_H
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5PropList.h"
|
||||
#include "H5Location.h"
|
||||
#include "H5Object.h"
|
||||
#include "H5AbstractDs.h"
|
||||
#include "H5Attribute.h"
|
||||
@@ -55,4 +56,4 @@
|
||||
#define HOFFSET(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // __H5Cpp_H
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5CPPDOC_H
|
||||
#define _H5CPPDOC_H
|
||||
#ifndef __H5CppDoc_H
|
||||
#define __H5CppDoc_H
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// The following section will be used to generate the 'Mainpage'
|
||||
@@ -23,39 +23,48 @@
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/*! \mainpage notitle
|
||||
*
|
||||
* <br />
|
||||
* \section intro_sec Introduction
|
||||
*
|
||||
* The C++ API provides C++ wrappers for the HDF5 C library.
|
||||
* 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
|
||||
* The C++ API provides C++ wrappers for the HDF5 C Library.
|
||||
*
|
||||
* It is assumed that the user has knowledge of the
|
||||
* <a href="http://www.hdfgroup.org/HDF5/doc/H5.format.html">
|
||||
* HDF5 file format</a> and its components.
|
||||
* For more information on the HDF5 C Library, see the
|
||||
* <a href="http://www.hdfgroup.org/HDF5/doc/index.html">
|
||||
* HDF5 Software Documentation</a> page.
|
||||
*
|
||||
* Because the HDF5 library maps very well to
|
||||
* Because the HDF5 C Library maps very well to
|
||||
* the object oriented design approach, classes in the C++ API can
|
||||
* closely represent the interfaces of the HDF5 APIs, as followed:
|
||||
* closely represent the interfaces of the C APIs as follows:
|
||||
*
|
||||
* \verbatim
|
||||
HDF5 C APIs C++ Classes
|
||||
----------- -----------
|
||||
Attribute Interface (H5A) Attribute
|
||||
Datasets Interface (H5D) DataSet
|
||||
Error Interface (H5E) Exception
|
||||
File Interface (H5F) H5File
|
||||
Group Interface (H5G) Group
|
||||
Identifier Interface (H5I) IdComponent
|
||||
Property List Interface (H5P) PropList and subclasses
|
||||
Dataspace Interface (H5S) DataSpace
|
||||
Datatype Interface (H5T) DataType and subclasses
|
||||
HDF5 C APIs C++ Classes
|
||||
----------- -----------
|
||||
Attribute Interface (H5A) Attribute
|
||||
Datasets Interface (H5D) DataSet
|
||||
Error Interface (H5E) Exception
|
||||
File Interface (H5F) H5File
|
||||
Group Interface (H5G) Group
|
||||
Identifier Interface (H5I) IdComponent
|
||||
Property List Interface (H5P) PropList and subclasses
|
||||
Dataspace Interface (H5S) DataSpace
|
||||
Datatype Interface (H5T) DataType and subclasses
|
||||
\endverbatim
|
||||
* <br />
|
||||
* \section install_sec Installation
|
||||
*
|
||||
* Please refer to the file release_docs/INSTALL_Windows.txt
|
||||
* under the top directory for information about installing, building,
|
||||
* The HDF5 C++ API is included with the HDF5 source code and can
|
||||
* be obtained from
|
||||
* <a href="http://www.hdfgroup.org/HDF5/release/obtainsrc.html">
|
||||
* http://www.hdfgroup.org/HDF5/release/obtainsrc.html</a>.
|
||||
*
|
||||
* Please refer to the release_docs/INSTALL file under the top directory
|
||||
* of the HDF5 source code for information about installing, building,
|
||||
* and testing the C++ API.
|
||||
*
|
||||
*
|
||||
* <br />
|
||||
*/
|
||||
|
||||
/// This example shows how to create datasets.
|
||||
@@ -88,4 +97,4 @@
|
||||
/// This example shows how to work with groups.
|
||||
///\example h5group.cpp
|
||||
|
||||
#endif
|
||||
#endif // __H5CppDoc_H
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "H5File.h"
|
||||
#include "H5Attribute.h"
|
||||
#include "H5DataSet.h"
|
||||
#include "H5private.h" // for HDfree
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
@@ -51,7 +52,7 @@ namespace H5 {
|
||||
///\brief Default constructor: creates a stub DataSet.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet() : AbstractDs(), H5Object(), id(0) {}
|
||||
DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet overloaded constructor
|
||||
@@ -59,9 +60,10 @@ DataSet::DataSet() : AbstractDs(), H5Object(), id(0) {}
|
||||
///\param existing_id - IN: Id of an existing dataset
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet(const hid_t existing_id) : AbstractDs(), H5Object()
|
||||
DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs()
|
||||
{
|
||||
id = existing_id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -70,7 +72,7 @@ DataSet::DataSet(const hid_t existing_id) : AbstractDs(), H5Object()
|
||||
///\param original - IN: DataSet instance to copy
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(original)
|
||||
DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs()
|
||||
{
|
||||
id = original.getId();
|
||||
incRefCount(); // increment number of references to this id
|
||||
@@ -78,75 +80,44 @@ DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(origi
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 dataset, creates a
|
||||
///\brief Given a reference, ref, to an hdf5 location, creates a
|
||||
/// DataSet object
|
||||
///\param obj - IN: Dataset reference object is in or location of
|
||||
///\param loc - IN: Dataset reference object is in or location of
|
||||
/// object that the dataset is located within.
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\exception H5::DataSetIException
|
||||
///\par Description
|
||||
/// \c obj can be DataSet, Group, H5File, or named DataType, that
|
||||
/// \c loc can be DataSet, Group, H5File, or named DataType, that
|
||||
/// is a datatype that has been named by DataType::commit.
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
// Modification
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object()
|
||||
DataSet::DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
id = p_dereference(obj.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("DataSet constructor - located by object",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 dataset, creates a
|
||||
/// DataSet object
|
||||
///\param h5file - IN: Location referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
// Modification
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object()
|
||||
{
|
||||
try {
|
||||
id = p_dereference(h5file.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("DataSet constructor - located by HDF5 file",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 dataset, creates a
|
||||
///\brief Given a reference, ref, to an hdf5 attribute, creates a
|
||||
/// DataSet object
|
||||
///\param attr - IN: Specifying location where the referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\exception H5::ReferenceException
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
// Modification
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataSet::DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type) : AbstractDs(), H5Object()
|
||||
DataSet::DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), AbstractDs(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
id = p_dereference(attr.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("DataSet constructor - located by attribute",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -167,7 +138,8 @@ DataSpace DataSet::getSpace() const
|
||||
throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
|
||||
}
|
||||
//create dataspace object using the existing id then return the object
|
||||
DataSpace data_space( dataspace_id );
|
||||
DataSpace data_space;
|
||||
f_DataSpace_setId(&data_space, dataspace_id);
|
||||
return( data_space );
|
||||
}
|
||||
|
||||
@@ -200,8 +172,8 @@ DSetCreatPropList DataSet::getCreatePlist() const
|
||||
throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
|
||||
}
|
||||
// create and return the DSetCreatPropList object
|
||||
DSetCreatPropList create_plist( create_plist_id );
|
||||
return( create_plist );
|
||||
DSetCreatPropList create_plist(create_plist_id); // ok to use existing id const
|
||||
return(create_plist);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -219,6 +191,71 @@ hsize_t DataSet::getStorageSize() const
|
||||
return(storage_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::getInMemDataSize
|
||||
///\brief Gets the size in memory of the dataset's data.
|
||||
///\return Size of data (in memory)
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - Apr 2009
|
||||
//--------------------------------------------------------------------------
|
||||
size_t DataSet::getInMemDataSize() const
|
||||
{
|
||||
const char *func = "DataSet::getInMemDataSize";
|
||||
|
||||
// Get the data type of this dataset
|
||||
hid_t mem_type_id = H5Dget_type(id);
|
||||
if( mem_type_id < 0 )
|
||||
{
|
||||
throw DataSetIException(func, "H5Dget_type failed");
|
||||
}
|
||||
|
||||
// Get the data type's size by first getting its native type then getting
|
||||
// the native type's size.
|
||||
hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
|
||||
if (native_type < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Tget_native_type failed");
|
||||
}
|
||||
size_t type_size = H5Tget_size(native_type);
|
||||
if (type_size == 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Tget_size failed");
|
||||
}
|
||||
|
||||
// Close the native type and the datatype of this dataset.
|
||||
if (H5Tclose(native_type) < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Tclose(native_type) failed");
|
||||
}
|
||||
if (H5Tclose(mem_type_id) < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Tclose(mem_type_id) failed");
|
||||
}
|
||||
|
||||
// Get number of elements of the dataset by first getting its dataspace,
|
||||
// then getting the number of elements in the dataspace
|
||||
hid_t space_id = H5Dget_space(id);
|
||||
if (space_id < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Dget_space failed");
|
||||
}
|
||||
hssize_t num_elements = H5Sget_simple_extent_npoints(space_id);
|
||||
if (num_elements < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Sget_simple_extent_npoints failed");
|
||||
}
|
||||
|
||||
// Close the dataspace
|
||||
if (H5Sclose(space_id) < 0)
|
||||
{
|
||||
throw DataSetIException(func, "H5Sclose failed");
|
||||
}
|
||||
|
||||
// Calculate and return the size of the data
|
||||
size_t data_size = type_size * num_elements;
|
||||
return(data_size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::getOffset
|
||||
///\brief Returns the address of this dataset in the file.
|
||||
@@ -261,7 +298,7 @@ void DataSet::getSpaceStatus(H5D_space_status_t& status) const
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
|
||||
hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) const
|
||||
{
|
||||
// Obtain identifiers for C API
|
||||
hid_t type_id = type.getId();
|
||||
@@ -277,6 +314,20 @@ hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
|
||||
return( size );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::getVlenBufSize
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\return Amount of storage
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
|
||||
{
|
||||
return(getVlenBufSize((const DataType)type, (const DataSpace)space));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::vlenReclaim
|
||||
///\brief Reclaims VL datatype memory buffers.
|
||||
@@ -363,21 +414,46 @@ void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_sp
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::read
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes a reference to a \c std::string for the buffer.
|
||||
/// It takes a reference to a \c H5std_string for the buffer.
|
||||
///\param strg - IN: Buffer for read data string
|
||||
///\param mem_type - IN: Memory datatype
|
||||
///\param mem_space - IN: Memory dataspace
|
||||
///\param file_space - IN: Dataset's dataspace in the file
|
||||
///\param xfer_plist - IN: Transfer property list for this I/O operation
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// Jul 2009
|
||||
// Follow the change to Attribute::read and use the following
|
||||
// private functions to read datasets with fixed- and
|
||||
// variable-length string:
|
||||
// DataSet::p_read_fixed_len and
|
||||
// DataSet::p_read_variable_len
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::read( H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
|
||||
void DataSet::read(H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist) const
|
||||
{
|
||||
// Allocate C character string for reading
|
||||
size_t size = mem_type.getSize();
|
||||
char* strg_C = new char[size+1]; // temporary C-string for C API
|
||||
// Check if this dataset has variable-len string or fixed-len string and
|
||||
// proceed appropriately.
|
||||
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
|
||||
if (is_variable_len < 0)
|
||||
{
|
||||
throw DataSetIException("DataSet::read", "H5Tis_variable_str failed");
|
||||
}
|
||||
|
||||
// Use the overloaded member to read
|
||||
read(strg_C, mem_type, mem_space, file_space, xfer_plist);
|
||||
// Obtain identifiers for C API
|
||||
hid_t mem_type_id = mem_type.getId();
|
||||
hid_t mem_space_id = mem_space.getId();
|
||||
hid_t file_space_id = file_space.getId();
|
||||
hid_t xfer_plist_id = xfer_plist.getId();
|
||||
|
||||
// Get the String and clean up
|
||||
strg = strg_C;
|
||||
delete []strg_C;
|
||||
if (!is_variable_len) // only allocate for fixed-len string
|
||||
{
|
||||
p_read_fixed_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
|
||||
}
|
||||
else
|
||||
{
|
||||
p_read_variable_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -414,17 +490,48 @@ void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace&
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::write
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes a reference to a \c std::string for the buffer.
|
||||
/// It takes a reference to a \c H5std_string for the buffer.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// Jul 2009
|
||||
// Modified to pass the buffer into H5Dwrite properly depending
|
||||
// whether the dataset has variable- or fixed-length string.
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::write( const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
|
||||
{
|
||||
// Convert string to C-string
|
||||
const char* strg_C;
|
||||
strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
|
||||
// Check if this attribute has variable-len string or fixed-len string and
|
||||
// proceed appropriately.
|
||||
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
|
||||
if (is_variable_len < 0)
|
||||
{
|
||||
throw DataSetIException("DataSet::write", "H5Tis_variable_str failed");
|
||||
}
|
||||
|
||||
// Use the overloaded member
|
||||
write(strg_C, mem_type, mem_space, file_space, xfer_plist);
|
||||
// Obtain identifiers for C API
|
||||
hid_t mem_type_id = mem_type.getId();
|
||||
hid_t mem_space_id = mem_space.getId();
|
||||
hid_t file_space_id = file_space.getId();
|
||||
hid_t xfer_plist_id = xfer_plist.getId();
|
||||
|
||||
// Convert string to C-string
|
||||
const char* strg_C;
|
||||
strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str
|
||||
herr_t ret_value = 0;
|
||||
|
||||
// Pass string in differently depends on variable or fixed length
|
||||
if (!is_variable_len)
|
||||
{
|
||||
ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C );
|
||||
}
|
||||
else
|
||||
{
|
||||
// passing string argument by address
|
||||
ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C );
|
||||
}
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw DataSetIException("DataSet::write", "H5Dwrite failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -467,7 +574,7 @@ int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& spa
|
||||
/// For more information, please see the Description section in
|
||||
/// C layer Reference Manual at:
|
||||
///\par
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5D.html#Dataset-Extend
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Extend
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::extend( const hsize_t* size ) const
|
||||
@@ -486,9 +593,11 @@ void DataSet::extend( const hsize_t* size ) const
|
||||
///\param buf_type - IN: Datatype of the elements in buffer
|
||||
///\param space - IN: Dataspace describing memory buffer & containing selection to use
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Programmer Binh-Minh Ribler - 2014
|
||||
// Modification
|
||||
// Used the non-const version.
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
|
||||
void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const
|
||||
{
|
||||
hid_t fill_type_id = fill_type.getId();
|
||||
hid_t buf_type_id = buf_type.getId();
|
||||
@@ -502,16 +611,32 @@ void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataT
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::fillMemBuf
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function in that it only takes the
|
||||
/// the last three arguments.
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\param fill - IN: Pointer to fill value to use - default NULL
|
||||
///\param fill_type - IN: Datatype of the fill value
|
||||
///\param buf - IN/OUT: Memory buffer to fill selection within
|
||||
///\param buf_type - IN: Datatype of the elements in buffer
|
||||
///\param space - IN: Dataspace describing memory buffer & containing selection to use
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
|
||||
void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
|
||||
{
|
||||
fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::fillMemBuf
|
||||
///\brief Fills a selection in memory with 0.
|
||||
///\param buf - IN/OUT: Memory buffer to fill selection within
|
||||
///\param buf_type - IN: Datatype of the elements in buffer
|
||||
///\param space - IN: Dataspace describing memory buffer & containing selection to use
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const
|
||||
{
|
||||
hid_t buf_type_id = buf_type.getId();
|
||||
hid_t space_id = space.getId();
|
||||
@@ -522,57 +647,26 @@ 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 \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_LINK (0) \tObject is a symbolic link.
|
||||
/// \li \c H5G_GROUP (1) \tObject is a group.
|
||||
/// \li \c H5G_DATASET (2) \tObject is a dataset.
|
||||
/// \li \c H5G_TYPE Object (3) \tis a named datatype
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - May, 2004
|
||||
// Function: DataSet::fillMemBuf
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\param buf - IN/OUT: Memory buffer to fill selection within
|
||||
///\param buf_type - IN: Datatype of the elements in buffer
|
||||
///\param space - IN: Dataspace describing memory buffer & containing selection to use
|
||||
///\exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
|
||||
void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space)
|
||||
{
|
||||
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_type - IN: Type of reference to get region of - default
|
||||
/// to H5R_DATASET_REGION
|
||||
///\param ref - IN: Reference to get region of
|
||||
///\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());
|
||||
}
|
||||
fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::getId
|
||||
// Purpose: Get the id of this attribute
|
||||
///\brief Get the id of this dataset.
|
||||
///\return DataSet identifier
|
||||
// Description:
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
// AbstractDs and Attribute are moved out of H5Object. In
|
||||
@@ -586,8 +680,76 @@ hid_t DataSet::getId() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::p_setId
|
||||
///\brief Sets the identifier of this object to a new value.
|
||||
// Function: DataSet::p_read_fixed_len (private)
|
||||
// brief Reads a fixed length \a H5std_string from a dataset.
|
||||
// param mem_type - IN: DataSet datatype (in memory)
|
||||
// param strg - IN: Buffer for read string
|
||||
// exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - Jul, 2009
|
||||
// Modification
|
||||
// Jul 2009
|
||||
// Added in follow to the change in Attribute::read
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const
|
||||
{
|
||||
// Only allocate for fixed-len string.
|
||||
|
||||
// Get the size of the dataset's data
|
||||
size_t data_size = getInMemDataSize();
|
||||
|
||||
// If there is data, allocate buffer and read it.
|
||||
if (data_size > 0)
|
||||
{
|
||||
char *strg_C = new char [data_size+1];
|
||||
HDmemset(strg_C, 0, data_size+1); // clear buffer
|
||||
|
||||
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C);
|
||||
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
delete []strg_C; // de-allocate for fixed-len string
|
||||
throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string");
|
||||
}
|
||||
|
||||
// Get string from the C char* and release resource allocated locally
|
||||
strg = strg_C;
|
||||
delete []strg_C;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::p_read_variable_len (private)
|
||||
// brief Reads a variable length \a H5std_string from an dataset.
|
||||
// param mem_type - IN: DataSet datatype (in memory)
|
||||
// param strg - IN: Buffer for read string
|
||||
// exception H5::DataSetIException
|
||||
// Programmer Binh-Minh Ribler - Jul, 2009
|
||||
// Modification
|
||||
// Jul 2009
|
||||
// Added in follow to the change in Attribute::read
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const
|
||||
{
|
||||
// Prepare and call C API to read dataset.
|
||||
char *strg_C;
|
||||
|
||||
// Read dataset, no allocation for variable-len string; C library will
|
||||
herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C);
|
||||
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw DataSetIException("DataSet::read", "H5Dread failed for variable length string");
|
||||
}
|
||||
|
||||
// Get string from the C char* and release resource allocated by C API
|
||||
strg = strg_C;
|
||||
HDfree(strg_C);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::p_setId (protected)
|
||||
///\brief Sets the identifier of this dataset to a new value.
|
||||
///
|
||||
///\exception H5::IdComponentException when the attempt to close the HDF5
|
||||
/// object fails
|
||||
@@ -608,10 +770,8 @@ void DataSet::p_setId(const hid_t new_id)
|
||||
}
|
||||
// reset object's id to the given id
|
||||
id = new_id;
|
||||
|
||||
// increment the reference counter of the new id
|
||||
//incRefCount();
|
||||
}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSet::close
|
||||
@@ -629,10 +789,8 @@ void DataSet::close()
|
||||
{
|
||||
throw DataSetIException("DataSet::close", "H5Dclose failed");
|
||||
}
|
||||
// reset the id when the dataset that it represents is no longer
|
||||
// referenced
|
||||
if (getCounter() == 0)
|
||||
id = 0;
|
||||
// reset the id
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,23 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// Class DataSet inherits from AbstractDs and provides accesses to a dataset.
|
||||
|
||||
#ifndef _H5DataSet_H
|
||||
#define _H5DataSet_H
|
||||
#ifndef __H5DataSet_H
|
||||
#define __H5DataSet_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class DataSet
|
||||
\brief Class DataSet operates on HDF5 datasets.
|
||||
|
||||
An datasets has many characteristics similar to an attribute, thus both
|
||||
Attribute and DataSet are derivatives of AbstractDs. DataSet also
|
||||
inherits from H5Object because a dataset is an HDF5 object.
|
||||
*/
|
||||
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
|
||||
public:
|
||||
|
||||
// Close this dataset.
|
||||
virtual void close();
|
||||
|
||||
@@ -32,9 +38,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
|
||||
void extend( const hsize_t* size ) const;
|
||||
|
||||
// Fills a selection in memory with a value
|
||||
void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space);
|
||||
void fillMemBuf(const void *fill, const DataType& fill_type, void *buf, const DataType& buf_type, const DataSpace& space) const;
|
||||
void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space); // kept for backward compatibility
|
||||
|
||||
// Fills a selection in memory with zero
|
||||
void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space);
|
||||
void fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& space) const;
|
||||
void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // kept for backward compatibility
|
||||
|
||||
// Gets the creation property list of this dataset.
|
||||
DSetCreatPropList getCreatePlist() const;
|
||||
@@ -49,10 +58,14 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
|
||||
void getSpaceStatus(H5D_space_status_t& status) const;
|
||||
|
||||
// Returns the amount of storage size required for this dataset.
|
||||
hsize_t getStorageSize() const;
|
||||
virtual hsize_t getStorageSize() const;
|
||||
|
||||
// Returns the in memory size of this attribute's data.
|
||||
virtual size_t getInMemDataSize() const;
|
||||
|
||||
// Returns the number of bytes required to store VL data.
|
||||
hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const;
|
||||
hsize_t getVlenBufSize(const DataType& type, const DataSpace& space ) const;
|
||||
hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // kept for backward compatibility
|
||||
|
||||
// Reclaims VL datatype memory buffers.
|
||||
static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf );
|
||||
@@ -73,21 +86,12 @@ 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.
|
||||
DataSet(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
DataSet(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
DataSet(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
DataSet(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
|
||||
DataSet(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
|
||||
|
||||
// Default constructor.
|
||||
DataSet();
|
||||
@@ -104,6 +108,12 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
|
||||
// Destructor: properly terminates access to this dataset.
|
||||
virtual ~DataSet();
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Sets the dataset id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
hid_t id; // HDF5 dataset id
|
||||
|
||||
@@ -113,11 +123,15 @@ class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
|
||||
// sub-types
|
||||
virtual hid_t p_get_type() const;
|
||||
|
||||
protected:
|
||||
// Sets the dataset id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
// Reads variable or fixed len strings from this dataset.
|
||||
void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
|
||||
void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
|
||||
|
||||
// Friend function to set DataSet id. For library use only.
|
||||
friend void f_DataSet_setId(DataSet* dset, hid_t new_id);
|
||||
|
||||
};
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5DataSet_H
|
||||
|
||||
@@ -85,6 +85,7 @@ DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) :
|
||||
DataSpace::DataSpace(const hid_t existing_id) : IdComponent()
|
||||
{
|
||||
id = existing_id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -93,7 +94,7 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent()
|
||||
///\param original - IN: DataSpace object to copy
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataSpace::DataSpace(const DataSpace& original) : IdComponent(original)
|
||||
DataSpace::DataSpace(const DataSpace& original) : IdComponent()
|
||||
{
|
||||
id = original.getId();
|
||||
incRefCount(); // increment number of references to this id
|
||||
@@ -279,7 +280,7 @@ H5S_class_t DataSpace::getSimpleExtentType () const
|
||||
///\exception H5::DataSpaceIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSpace::extentCopy ( DataSpace& dest_space ) const
|
||||
void DataSpace::extentCopy (const DataSpace& dest_space) const
|
||||
{
|
||||
hid_t dest_space_id = dest_space.getId();
|
||||
herr_t ret_value = H5Sextent_copy( dest_space_id, id );
|
||||
@@ -289,6 +290,20 @@ void DataSpace::extentCopy ( DataSpace& dest_space ) const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpace::extentCopy
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const. This wrapper will be removed in future release.
|
||||
///\param dest_space - IN: Dataspace to copy from
|
||||
///\exception H5::DataSpaceIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSpace::extentCopy( DataSpace& dest_space ) const
|
||||
{
|
||||
extentCopy((const DataSpace)dest_space);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpace::setExtentSimple
|
||||
///\brief Sets or resets the size of an existing dataspace.
|
||||
@@ -408,7 +423,7 @@ hssize_t DataSpace::getSelectElemNpoints () const
|
||||
///\par Description
|
||||
/// For more information, please refer to the C layer Reference
|
||||
/// Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElemPointList
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElemPointList
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const
|
||||
@@ -432,7 +447,7 @@ void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints,
|
||||
///\par Description
|
||||
/// For more information, please refer to the C layer Reference
|
||||
/// Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectBounds
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const
|
||||
@@ -446,7 +461,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpace::H5Sselect_elements
|
||||
// Function: DataSpace::selectElements
|
||||
///\brief Selects array elements to be included in the selection for
|
||||
/// this dataspace.
|
||||
///\param op - IN: Operator specifying how the new selection is to be
|
||||
@@ -458,7 +473,7 @@ void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const
|
||||
///\par Description
|
||||
/// For more information, please refer to the C layer Reference
|
||||
/// Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElements
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectElements
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const
|
||||
@@ -540,7 +555,7 @@ bool DataSpace::selectValid () const
|
||||
///\par Description
|
||||
/// For more information, please refer to the C layer Reference
|
||||
/// Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectHyperslab
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block ) const
|
||||
@@ -556,7 +571,8 @@ void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const h
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpace::getId
|
||||
// Purpose: Get the id of this attribute
|
||||
///\brief Get the id of this dataspace
|
||||
///\return Dataspace identifier
|
||||
// Modification:
|
||||
// May 2008 - BMR
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
@@ -570,6 +586,7 @@ hid_t DataSpace::getId() const
|
||||
return(id);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpace::p_setId
|
||||
///\brief Sets the identifier of this object to a new value.
|
||||
@@ -594,6 +611,7 @@ void DataSpace::p_setId(const hid_t new_id)
|
||||
// reset object's id to the given id
|
||||
id = new_id;
|
||||
}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpace::close
|
||||
@@ -612,10 +630,8 @@ void DataSpace::close()
|
||||
{
|
||||
throw DataSpaceIException("DataSpace::close", "H5Sclose failed");
|
||||
}
|
||||
// reset the id when the dataspace that it represents is no longer
|
||||
// referenced
|
||||
if (getCounter() == 0)
|
||||
id = 0;
|
||||
// reset the id
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5DataSpace_H
|
||||
#define _H5DataSpace_H
|
||||
#ifndef __H5DataSpace_H
|
||||
#define __H5DataSpace_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
//! Class DataSpace operates on HDF5 dataspaces.
|
||||
class H5_DLLCPP DataSpace : public IdComponent {
|
||||
public:
|
||||
// Default DataSpace objects
|
||||
@@ -32,6 +33,12 @@ class H5_DLLCPP DataSpace : public IdComponent {
|
||||
// Creates a simple dataspace
|
||||
DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
|
||||
|
||||
// Creates a DataSpace object using an existing dataspace id.
|
||||
DataSpace(const hid_t space_id);
|
||||
|
||||
// Copy constructor: makes a copy of the original DataSpace object.
|
||||
DataSpace(const DataSpace& original);
|
||||
|
||||
// Assignment operator
|
||||
DataSpace& operator=( const DataSpace& rhs );
|
||||
|
||||
@@ -42,7 +49,9 @@ class H5_DLLCPP DataSpace : public IdComponent {
|
||||
void copy(const DataSpace& like_space);
|
||||
|
||||
// Copies the extent of this dataspace.
|
||||
void extentCopy( DataSpace& dest_space ) const;
|
||||
void extentCopy(const DataSpace& dest_space) const;
|
||||
// Kept for backward compatibility only.
|
||||
void extentCopy(DataSpace& dest_space) const;
|
||||
|
||||
// Gets the bounding box containing the current selection.
|
||||
void getSelectBounds( hsize_t* start, hsize_t* end ) const;
|
||||
@@ -103,29 +112,28 @@ 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.
|
||||
DataSpace(const hid_t space_id);
|
||||
|
||||
// Copy constructor: makes a copy of the original DataSpace object.
|
||||
DataSpace(const DataSpace& original);
|
||||
|
||||
// Gets the dataspace id.
|
||||
virtual hid_t getId() const;
|
||||
|
||||
// Destructor: properly terminates access to this dataspace.
|
||||
virtual ~DataSpace();
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Sets the dataspace id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
hid_t id; // HDF5 dataspace id
|
||||
|
||||
protected:
|
||||
// Sets the dataspace id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
// Friend function to set DataSpace id. For library use only.
|
||||
friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id);
|
||||
};
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5DataSpace_H
|
||||
|
||||
@@ -48,24 +48,30 @@ namespace H5 {
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType default constructor
|
||||
///\brief Default constructor: Creates a stub datatype
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType overloaded constructor
|
||||
///\brief Creates a datatype using an existing datatype's id
|
||||
///\param existing_id - IN: Id of the existing datatype
|
||||
///\param predefined - IN: Indicates whether or not this datatype is
|
||||
/// a predefined datatype; default to \c false
|
||||
// Description
|
||||
// Constructor creates a copy of an existing DataType using
|
||||
// its id. The argument "predefined" is default to false;
|
||||
// when a default datatype is created, this argument is set
|
||||
// to true so H5Tclose will not be called on it later. - need
|
||||
// a reassessment after changing to the new ref counting mech.
|
||||
// - BMR 5/2004
|
||||
// its id.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// Dec, 2005
|
||||
// Removed second argument, "predefined", after changing to the
|
||||
// new ref counting mechanism that relies on C's ref counting.
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(const hid_t existing_id) : H5Object()
|
||||
{
|
||||
id = existing_id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -90,49 +96,19 @@ DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object()
|
||||
// Function: DataType overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 group, creates a
|
||||
/// DataType object
|
||||
///\param obj - IN: Specifying location referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\exception H5::ReferenceException
|
||||
///\par Description
|
||||
/// \c obj can be DataSet, Group, or named DataType, that
|
||||
/// is a datatype that has been named by DataType::commit.
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
// Modification
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
{
|
||||
try {
|
||||
id = p_dereference(obj.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("DataType constructor - located by an H5Object",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 group, creates a
|
||||
/// DataType object
|
||||
///\param h5file - IN: Location referenced object is in
|
||||
///\param loc - IN: Location referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\exception H5::ReferenceException
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
// Modification
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
DataType::DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object()
|
||||
{
|
||||
try {
|
||||
id = p_dereference(h5file.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("DataType constructor - located by an H5File",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -142,40 +118,50 @@ DataType::DataType(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Obj
|
||||
///\param attr - IN: Specifying location where the referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\exception H5::ReferenceException
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
// Modification
|
||||
// Jul, 2008
|
||||
// Added for application convenience.
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
id = p_dereference(attr.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("DataType constructor - located by an Attribute",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType default constructor
|
||||
///\brief Default constructor: Creates a stub datatype
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType() : H5Object(), id(0) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType copy constructor
|
||||
///\brief Copy constructor: makes a copy of the original DataType object.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(const DataType& original) : H5Object(original)
|
||||
DataType::DataType(const DataType& original) : H5Object()
|
||||
{
|
||||
id = original.getId();
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType overloaded constructor
|
||||
///\brief Creates a integer type using a predefined type
|
||||
///\param pred_type - IN: Predefined datatype
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Description
|
||||
// Copying the type so that when a predefined type is passed in,
|
||||
// a copy of it is made, not just a duplicate of the HDF5 id.
|
||||
// Note: calling DataType::copy will invoke DataType::close()
|
||||
// unnecessarily and will produce undefined behavior.
|
||||
// -BMR, Apr 2015
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::DataType(const PredType& pred_type) : H5Object()
|
||||
{
|
||||
// call C routine to copy the datatype
|
||||
id = H5Tcopy( pred_type.getId() );
|
||||
if (id < 0)
|
||||
throw DataTypeIException("DataType constructor", "H5Tcopy failed");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::copy
|
||||
///\brief Copies an existing datatype to this datatype object
|
||||
@@ -210,7 +196,7 @@ void DataType::copy( const DataType& like_type )
|
||||
///\param dset - IN: Dataset
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - Jan, 2007
|
||||
///\parDescription
|
||||
///\par Description
|
||||
/// The resulted dataset will be transient and modifiable.
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::copy(const DataSet& dset)
|
||||
@@ -239,11 +225,22 @@ void DataType::copy(const DataSet& dset)
|
||||
// Makes a copy of the type on the right hand side and stores
|
||||
// the new id in the left hand side object.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// Changed operator= to simply copy the id of rhs instead of
|
||||
// calling H5Tcopy because, when the operator= is invoked, a
|
||||
// different datatype id is created and it won't have the same
|
||||
// characteristics as the original one, specifically, if the
|
||||
// rhs represents a named datatype, "this" would still be a
|
||||
// transient datatype.
|
||||
// BMR - Mar, 2015
|
||||
//--------------------------------------------------------------------------
|
||||
DataType& DataType::operator=( const DataType& rhs )
|
||||
{
|
||||
if (this != &rhs)
|
||||
copy(rhs);
|
||||
{
|
||||
id = rhs.id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
return(*this);
|
||||
}
|
||||
|
||||
@@ -297,38 +294,27 @@ void DataType::p_commit(hid_t loc_id, const char* name)
|
||||
// Function: DataType::commit
|
||||
///\brief Commits a transient datatype to a file, creating a new
|
||||
/// named datatype
|
||||
///\param loc - IN: A file
|
||||
///\param name - IN: Name of the datatype
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::commit(H5File& loc, const char* name)
|
||||
{
|
||||
p_commit(loc.getLocId(), name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::commit
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in the type of the
|
||||
/// argument \a name.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::commit(H5File& loc, const H5std_string& name)
|
||||
{
|
||||
p_commit(loc.getLocId(), name.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::commit
|
||||
///\brief Commits a transient datatype to a file, creating a new
|
||||
/// named datatype
|
||||
///\param loc - IN: Either a group, dataset, named datatype, or attribute.
|
||||
///\param loc - IN: A location (file, dataset, datatype, or group)
|
||||
///\param name - IN: Name of the datatype
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - Jan, 2007
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::commit(H5Object& loc, const char* name)
|
||||
void DataType::commit(const H5Location& loc, const char* name)
|
||||
{
|
||||
p_commit(loc.getId(), name);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::commit
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\param loc - IN: A location (file, dataset, datatype, or group)
|
||||
///\param name - IN: Name of the datatype
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - Jan, 2007
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::commit(H5Location& loc, const char* name)
|
||||
{
|
||||
p_commit(loc.getId(), name);
|
||||
}
|
||||
@@ -340,7 +326,22 @@ void DataType::commit(H5Object& loc, const char* name)
|
||||
/// argument \a name.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::commit(H5Object& loc, const H5std_string& name)
|
||||
void DataType::commit(const H5Location& loc, const H5std_string& name)
|
||||
{
|
||||
p_commit(loc.getId(), name.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::commit
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\param loc - IN: A location (file, dataset, datatype, or group)
|
||||
///\param name - IN: Name of the datatype
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - Jan, 2007
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::commit(H5Location& loc, const H5std_string& name)
|
||||
{
|
||||
p_commit(loc.getId(), name.c_str());
|
||||
}
|
||||
@@ -397,7 +398,7 @@ H5T_conv_t DataType::find( const DataType& dest, H5T_cdata_t **pcdata ) const
|
||||
///\param buf - IN/OUT: Array containing pre- and post-conversion
|
||||
/// values
|
||||
///\param background - IN: Optional backgroud buffer
|
||||
///\param plist - IN: Dataset transfer property list
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\return Pointer to a suitable conversion function
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
@@ -495,8 +496,9 @@ DataType DataType::getSuper() const
|
||||
// the base type, otherwise, raise exception
|
||||
if( base_type_id > 0 )
|
||||
{
|
||||
DataType base_type( base_type_id );
|
||||
return( base_type );
|
||||
DataType base_type;
|
||||
base_type.p_setId(base_type_id);
|
||||
return(base_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -517,7 +519,7 @@ DataType DataType::getSuper() const
|
||||
///\exception H5::DataTypeIException
|
||||
///\par Description
|
||||
/// For more information, please see:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5T.html#Datatype-Register
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-Register
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DataType::registerFunc( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const
|
||||
@@ -627,7 +629,7 @@ H5std_string DataType::getTag() const
|
||||
if( tag_Cstr != NULL )
|
||||
{
|
||||
H5std_string tag = H5std_string(tag_Cstr); // C string to string object
|
||||
HDfree(tag_Cstr); // free the C string
|
||||
H5free_memory(tag_Cstr); // free the C string
|
||||
return (tag); // return the tag
|
||||
}
|
||||
else
|
||||
@@ -681,54 +683,10 @@ 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
|
||||
///\brief Get the id of this datatype
|
||||
///\return Datatype identifier
|
||||
// Modification:
|
||||
// May 2008 - BMR
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
@@ -742,6 +700,7 @@ hid_t DataType::getId() const
|
||||
return(id);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::p_setId
|
||||
///\brief Sets the identifier of this object to a new value.
|
||||
@@ -766,6 +725,7 @@ void DataType::p_setId(const hid_t new_id)
|
||||
// reset object's id to the given id
|
||||
id = new_id;
|
||||
}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataType::close
|
||||
@@ -783,10 +743,8 @@ void DataType::close()
|
||||
{
|
||||
throw DataTypeIException(inMemFunc("close"), "H5Tclose failed");
|
||||
}
|
||||
// reset the id when the datatype that it represents is no longer
|
||||
// referenced
|
||||
if (getCounter() == 0)
|
||||
id = 0;
|
||||
// reset the id
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -796,17 +754,33 @@ void DataType::close()
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// - Replaced resetIdComponent() with decRefCount() to use C
|
||||
// library ID reference counting mechanism - BMR, Jun 1, 2004
|
||||
// library ID reference counting mechanism - BMR, Jun 1, 2004
|
||||
// - Replaced decRefCount with close() to let the C library
|
||||
// handle the reference counting - BMR, Jun 1, 2006
|
||||
// handle the reference counting - BMR, Jun 1, 2006
|
||||
// - Added the use of H5CPP_EXITED to terminate the HDF5 library
|
||||
// and elimiate previous memory leaks. See comments in the
|
||||
// header file "H5PredType.h" for details. - BMR, Mar 30, 2012
|
||||
//--------------------------------------------------------------------------
|
||||
DataType::~DataType()
|
||||
{
|
||||
try {
|
||||
close();
|
||||
} catch (Exception close_error) {
|
||||
cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
|
||||
try
|
||||
{
|
||||
/* If this is the object AtExit, terminate the HDF5 library. This is
|
||||
to eliminate memory leaks due to the library being re-initiated
|
||||
(after the program has ended) and not re-terminated. */
|
||||
if (id == H5CPP_EXITED)
|
||||
{
|
||||
herr_t ret_value = H5close();
|
||||
if (ret_value == FAIL)
|
||||
throw DataTypeIException(inMemFunc("~DataType - "), "H5close failed");
|
||||
}
|
||||
// Close the HDF5 datatype
|
||||
else
|
||||
close();
|
||||
}
|
||||
catch (Exception close_error) {
|
||||
cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl;
|
||||
}
|
||||
}
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
|
||||
@@ -14,13 +14,20 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5DataType_H
|
||||
#define _H5DataType_H
|
||||
#ifndef __H5DataType_H
|
||||
#define __H5DataType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class DataType
|
||||
\brief Class DataType provides generic operations on HDF5 datatypes.
|
||||
|
||||
DataType inherits from H5Object because a named datatype is an HDF5
|
||||
object and is a base class of ArrayType, AtomType, CompType, EnumType,
|
||||
and VarLenType.
|
||||
*/
|
||||
class H5_DLLCPP DataType : public H5Object {
|
||||
public:
|
||||
// Creates a datatype given its class and size
|
||||
@@ -29,10 +36,12 @@ class H5_DLLCPP DataType : public H5Object {
|
||||
// Copy constructor: makes a copy of the original object
|
||||
DataType( const DataType& original );
|
||||
|
||||
// Creates a copy of a predefined type
|
||||
DataType(const PredType& pred_type);
|
||||
|
||||
// Creates a datatype by way of dereference.
|
||||
DataType(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
DataType(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
DataType(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
DataType(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
|
||||
DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
|
||||
|
||||
// Closes this datatype.
|
||||
virtual void close();
|
||||
@@ -48,10 +57,12 @@ class H5_DLLCPP DataType : public H5Object {
|
||||
|
||||
// Commits a transient datatype to a file; this datatype becomes
|
||||
// a named datatype which can be accessed from the location.
|
||||
void commit( H5File& loc, const char* name);
|
||||
void commit( H5File& loc, const H5std_string& name);
|
||||
void commit( H5Object& loc, const char* name);
|
||||
void commit( H5Object& loc, const H5std_string& name);
|
||||
void commit(const H5Location& loc, const char* name);
|
||||
void commit(const H5Location& loc, const H5std_string& name);
|
||||
// These two overloaded functions are kept for backward compatibility
|
||||
// only; they missed the const.
|
||||
void commit(H5Location& loc, const char* name);
|
||||
void commit(H5Location& loc, const H5std_string& name);
|
||||
|
||||
// Determines whether this datatype is a named datatype or
|
||||
// a transient datatype.
|
||||
@@ -101,15 +112,7 @@ 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
|
||||
@@ -125,15 +128,20 @@ class H5_DLLCPP DataType : public H5Object {
|
||||
virtual ~DataType();
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
hid_t id; // HDF5 datatype id
|
||||
|
||||
// Sets the datatype id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
// Friend function to set DataType id. For library use only.
|
||||
friend void f_DataType_setId(DataType* dtype, hid_t new_id);
|
||||
|
||||
void p_commit(hid_t loc_id, const char* name);
|
||||
};
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5DataType_H
|
||||
|
||||
@@ -106,8 +106,8 @@ int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const
|
||||
///\param layout - IN: Type of storage layout for raw data
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information on setting layout type, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetLayout
|
||||
/// For information on valid layout types, please refer to
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLayout
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setLayout(H5D_layout_t layout) const
|
||||
@@ -211,7 +211,7 @@ void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_p
|
||||
///\par
|
||||
/// For information on setting fill value, please refer to the
|
||||
/// C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFillValue
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const
|
||||
@@ -349,13 +349,16 @@ int DSetCreatPropList::getNfilters() const
|
||||
///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
|
||||
/// of values defined by the filter
|
||||
///\param cd_values - OUT: Array to hold the data; allocated by the user
|
||||
///\param namelen - OUT: Length of \a name
|
||||
///\param namelen - IN: Length of \a name
|
||||
///\param name - OUT: Name of the filter
|
||||
///\param filter_config - OUT: Flags indicating whether filter can encode/decode
|
||||
///\return Filter id
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Failure occurs when \a filter_number is out of range.
|
||||
// Note: the first argument was mistakenly typed as int instead
|
||||
// of unsigned int, but for backward compatibility, it cannot be
|
||||
// changed. -BMR (2014/04/15)
|
||||
//--------------------------------------------------------------------------
|
||||
H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
|
||||
unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
|
||||
@@ -459,7 +462,7 @@ bool DSetCreatPropList::allFiltersAvail()
|
||||
///\par Description
|
||||
/// Please refer to the Reference Manual of \c H5Pset_shuffle for
|
||||
/// details.
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetShuffle
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetCreatPropList::setShuffle() const
|
||||
@@ -635,8 +638,8 @@ int DSetCreatPropList::getExternalCount() const
|
||||
///\param idx - IN: Index of the external file, ranges [0-(N-1)] and
|
||||
/// returned by getExternalCount()
|
||||
///\param name_size - IN: Maximum length of \a name
|
||||
///\param name - IN: Name of the external file
|
||||
///\param offset - IN: Location to return an offset value
|
||||
///\param name - OUT: Name of the external file
|
||||
///\param offset - OUT: Location to return an offset value
|
||||
///\param size - OUT: Location to return the size of the external file data
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
|
||||
@@ -14,13 +14,17 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5DSCreatPropList_H
|
||||
#define _H5DSCreatPropList_H
|
||||
#ifndef __H5DSCreatPropList_H
|
||||
#define __H5DSCreatPropList_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class DSetCreatPropList
|
||||
\brief Class DSetCreatPropList represents the dataset creation property
|
||||
list.
|
||||
*/
|
||||
class H5_DLLCPP DSetCreatPropList : public PropList {
|
||||
public:
|
||||
// Default dataset creation property list.
|
||||
@@ -107,7 +111,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.
|
||||
@@ -123,4 +127,4 @@ class H5_DLLCPP DSetCreatPropList : public PropList {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5DSCreatPropList_H
|
||||
|
||||
@@ -20,6 +20,17 @@
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5PropList.h"
|
||||
#include "H5DxferProp.h"
|
||||
#include "H5private.h" // for HDmemset
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
#ifndef H5_NO_STD
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
#endif // H5_NO_STD
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
@@ -38,6 +49,17 @@ const DSetMemXferPropList DSetMemXferPropList::DEFAULT;
|
||||
//--------------------------------------------------------------------------
|
||||
DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function DSetMemXferPropList constructor
|
||||
///\brief Creates a dataset transfer property list with transform
|
||||
/// expression.
|
||||
// Programmer: Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
DSetMemXferPropList::DSetMemXferPropList(const char* exp) : PropList(H5P_DATASET_XFER)
|
||||
{
|
||||
setDataTransform(exp);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function DSetMemXferPropList copy constructor
|
||||
///\brief Copy constructor: makes a copy of the original
|
||||
@@ -175,7 +197,110 @@ void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double&
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setTypeConvCB
|
||||
// Function: DSetMemXferPropList::setDataTransform
|
||||
///\brief Sets data transform expression.
|
||||
///\param expression - IN: null-terminated data transform expression (char*)
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - Mar, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setDataTransform(const char* expression) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_data_transform( id, expression);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setDataTransform",
|
||||
"H5Pset_data_transform failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setDataTransform
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes a reference to a \c H5std_string for the expression.
|
||||
///\param expression - IN: H5std_string data transform expression
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - Mar, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const
|
||||
{
|
||||
setDataTransform(expression.c_str());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getDataTransform
|
||||
///\brief Sets data transform expression.
|
||||
///\param exp - OUT: buffer for data transform expression (char*)
|
||||
///\param buf_size - IN: size of buffer for expression, including the
|
||||
/// null terminator
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - Mar, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const
|
||||
{
|
||||
// H5Pget_data_transform will get buf_size characters of the expression
|
||||
// including the null terminator
|
||||
ssize_t exp_len;
|
||||
exp_len = H5Pget_data_transform(id, exp, buf_size);
|
||||
|
||||
// H5Pget_data_transform returns a negative value, raise an exception
|
||||
if (exp_len < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getDataTransform",
|
||||
"H5Pget_data_transform failed");
|
||||
}
|
||||
|
||||
// H5Pget_data_transform will put a null terminator at the end of the
|
||||
// expression or at [buf_size-1] if the expression is at least the size
|
||||
// of the buffer.
|
||||
|
||||
// Return the expression length, which might be different from buf_size
|
||||
return(exp_len);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getDataTransform
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes no parameter and returns a \c H5std_string for the expression.
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - Mar, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string DSetMemXferPropList::getDataTransform() const
|
||||
{
|
||||
// Initialize string to "", so that if there is no expression, the returned
|
||||
// string will be empty
|
||||
H5std_string expression("");
|
||||
|
||||
// Preliminary call to get the expression's length
|
||||
ssize_t exp_len = H5Pget_data_transform(id, NULL, (size_t)0);
|
||||
|
||||
// If H5Pget_data_transform returns a negative value, raise an exception
|
||||
if (exp_len < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed");
|
||||
}
|
||||
|
||||
// If expression exists, calls C routine again to get it
|
||||
else if (exp_len > 0)
|
||||
{
|
||||
// Temporary buffer for char* expression
|
||||
char* exp_C = new char[exp_len+1];
|
||||
HDmemset(exp_C, 0, exp_len+1); // clear buffer
|
||||
|
||||
// Used overloaded function
|
||||
exp_len = getDataTransform(exp_C, exp_len+1);
|
||||
|
||||
// Convert the C expression to return
|
||||
expression = exp_C;
|
||||
|
||||
// Clean up resource
|
||||
delete []exp_C;
|
||||
}
|
||||
// Return the string expression
|
||||
return(expression);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getTypeConvCB
|
||||
///\brief Sets an exception handling callback for datatype conversion
|
||||
/// for a dataset transfer property list.
|
||||
///\param op - IN: User's function
|
||||
@@ -265,43 +390,6 @@ void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void**
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setMulti
|
||||
///\brief Sets the data transfer property list for the multi-file driver.
|
||||
///\param memb_dxpl - OUT: Array of data access property lists
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// This function can only be used after the member map has
|
||||
/// been set with FileAccPropList::setMulti (not done - BMR.)
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setMulti(const hid_t *memb_dxpl)
|
||||
{
|
||||
herr_t ret_value = H5Pset_dxpl_multi(id, memb_dxpl);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::setMulti",
|
||||
"H5Pset_dxpl_multi failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::getMulti
|
||||
///\brief Returns multi-file data transfer property list information.
|
||||
///\param memb_dxpl - OUT: Array of data access property lists
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::getMulti(hid_t *memb_dxpl)
|
||||
{
|
||||
herr_t ret_value = H5Pget_dxpl_multi(id, memb_dxpl);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("DSetMemXferPropList::getMulti",
|
||||
"H5Pget_dxpl_multi failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DSetMemXferPropList::setSmallDataBlockSize
|
||||
///\brief Sets the size of a contiguous block reserved for small data.
|
||||
@@ -309,7 +397,7 @@ void DSetMemXferPropList::getMulti(hid_t *memb_dxpl)
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail, please refer to the C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSmallData
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
|
||||
@@ -349,7 +437,7 @@ hsize_t DSetMemXferPropList::getSmallDataBlockSize()
|
||||
///\par Description
|
||||
/// For information, please refer to the C layer Reference
|
||||
/// Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetHyperVectorSize
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
|
||||
|
||||
@@ -14,13 +14,17 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5DSetMemXferPropList_H
|
||||
#define _H5DSetMemXferPropList_H
|
||||
#ifndef __H5DSetMemXferPropList_H
|
||||
#define __H5DSetMemXferPropList_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class DSetMemXferPropList
|
||||
\brief Class DSetMemXferPropList represents the dataset memory and
|
||||
transfer property list.
|
||||
*/
|
||||
class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
public:
|
||||
static const DSetMemXferPropList DEFAULT;
|
||||
@@ -28,6 +32,9 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
// Creates a dataset memory and transfer property list.
|
||||
DSetMemXferPropList();
|
||||
|
||||
// Creates a dataset transform property list.
|
||||
DSetMemXferPropList(const char* expression);
|
||||
|
||||
// Sets type conversion and background buffers.
|
||||
void setBuffer( size_t size, void* tconv, void* bkg ) const;
|
||||
|
||||
@@ -40,6 +47,14 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
// Gets B-tree split ratios for a dataset transfer property list.
|
||||
void getBtreeRatios( double& left, double& middle, double& right ) const;
|
||||
|
||||
// Sets data transform expression.
|
||||
void setDataTransform(const char* expression) const;
|
||||
void setDataTransform(const H5std_string& expression) const;
|
||||
|
||||
// Gets data transform expression.
|
||||
ssize_t getDataTransform(char* exp, size_t buf_size=0) const;
|
||||
H5std_string getDataTransform() const;
|
||||
|
||||
// Sets the dataset transfer property list status to TRUE or FALSE.
|
||||
void setPreserve( bool status ) const;
|
||||
|
||||
@@ -66,12 +81,6 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info,
|
||||
H5MM_free_t& free, void** free_info ) const;
|
||||
|
||||
// Sets the data transfer property list for the multi-file driver.
|
||||
void setMulti(const hid_t *memb_dxpl);
|
||||
|
||||
// Returns multi-file data transfer property list information.
|
||||
void getMulti(hid_t *memb_dxpl);
|
||||
|
||||
// Sets the size of a contiguous block reserved for small data.
|
||||
void setSmallDataBlockSize(hsize_t size);
|
||||
|
||||
@@ -92,7 +101,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.
|
||||
@@ -108,4 +117,5 @@ class H5_DLLCPP DSetMemXferPropList : public PropList {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5DSetMemXferPropList_H
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "H5AtomType.h"
|
||||
#include "H5IntType.h"
|
||||
#include "H5EnumType.h"
|
||||
#include "H5private.h" // for HDmemset
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
@@ -150,6 +151,7 @@ void EnumType::insert( const H5std_string& name, void *value ) const
|
||||
H5std_string EnumType::nameOf( void *value, size_t size ) const
|
||||
{
|
||||
char* name_C = new char[size+1]; // temporary C-string for C API
|
||||
HDmemset(name_C, 0, size+1); // clear buffer
|
||||
|
||||
// Calls C routine H5Tenum_nameof to get the name of the specified enum type
|
||||
herr_t ret_value = H5Tenum_nameof( id, value, name_C, size );
|
||||
@@ -157,10 +159,11 @@ H5std_string EnumType::nameOf( void *value, size_t size ) const
|
||||
// If H5Tenum_nameof returns a negative value, raise an exception,
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
delete []name_C;
|
||||
throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed");
|
||||
}
|
||||
// otherwise, create the string to hold the datatype name and return it
|
||||
H5std_string name = H5std_string(name_C);
|
||||
H5std_string name(name_C);
|
||||
delete []name_C;
|
||||
return( name );
|
||||
}
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5EnumType_H
|
||||
#define _H5EnumType_H
|
||||
#ifndef __H5EnumType_H
|
||||
#define __H5EnumType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
//! Class EnumType operates on HDF5 enum datatypes.
|
||||
class H5_DLLCPP EnumType : public DataType {
|
||||
|
||||
public:
|
||||
@@ -57,7 +58,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
|
||||
@@ -74,4 +75,4 @@ class H5_DLLCPP EnumType : public DataType {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5EnumType_H
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
const H5std_string Exception::DEFAULT_MSG("No detailed information provided");
|
||||
const char Exception::DEFAULT_MSG[] = "No detailed information provided";
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Exception default constructor
|
||||
@@ -35,11 +35,11 @@ Exception::Exception() : detail_message(""), func_name("") {}
|
||||
// Function: Exception overloaded constructor
|
||||
///\brief Creates an exception with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
Exception::Exception(const H5std_string& func_name, const H5std_string& message) : detail_message(message), func_name(func_name) {}
|
||||
Exception::Exception(const H5std_string& func, const H5std_string& message) : detail_message(message), func_name(func) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Exception copy constructor
|
||||
@@ -80,8 +80,11 @@ H5std_string Exception::getMajorString( hid_t err_major ) const
|
||||
|
||||
// Check for failure again
|
||||
if( mesg_size < 0 )
|
||||
{
|
||||
delete []mesg_C;
|
||||
throw IdComponentException("Exception::getMajorString",
|
||||
"H5Eget_msg failed");
|
||||
}
|
||||
|
||||
// Convert the C error description and return
|
||||
H5std_string major_str(mesg_C);
|
||||
@@ -116,8 +119,11 @@ H5std_string Exception::getMinorString( hid_t err_minor ) const
|
||||
|
||||
// Check for failure again
|
||||
if( mesg_size < 0 )
|
||||
{
|
||||
delete []mesg_C;
|
||||
throw IdComponentException("Exception::getMinorString",
|
||||
"H5Eget_msg failed");
|
||||
}
|
||||
|
||||
// Convert the C error description and return
|
||||
H5std_string minor_str(mesg_C);
|
||||
@@ -252,7 +258,7 @@ void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk2_t func, voi
|
||||
// Function: Exception::getDetailMsg
|
||||
///\brief Returns the detailed message set at the time the exception
|
||||
/// is thrown.
|
||||
///\return Text message - \c std::string
|
||||
///\return Text message - \c H5std_string
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string Exception::getDetailMsg() const
|
||||
@@ -275,7 +281,7 @@ const char* Exception::getCDetailMsg() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Exception::getFuncName
|
||||
///\brief Returns the name of the function, where the exception is thrown.
|
||||
///\return Text message - \c std::string
|
||||
///\return Text message - \c H5std_string
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string Exception::getFuncName() const
|
||||
@@ -295,16 +301,33 @@ const char* Exception::getCFuncName() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Exception::printError
|
||||
// Function: Exception::printErrorStack (static)
|
||||
///\brief Prints the error stack in a default manner.
|
||||
///\param stream - IN: File pointer
|
||||
///\param stream - IN: File pointer, default to stderr
|
||||
///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0)
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void Exception::printError( FILE* stream ) const
|
||||
void Exception::printErrorStack(FILE* stream, hid_t err_stack)
|
||||
{
|
||||
herr_t ret_value = H5Eprint2( H5E_DEFAULT, stream ); // print to stderr
|
||||
herr_t ret_value = H5Eprint2(err_stack, stream);
|
||||
if( ret_value < 0 )
|
||||
throw Exception( "Exception::printError", "H5Eprint failed" );
|
||||
throw Exception( "Printing error stack", "H5Eprint2 failed" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Exception::printError
|
||||
///\brief Prints the error stack in a default manner. This member
|
||||
/// function is replaced by the static function printErrorStack
|
||||
/// and will be removed from the next major release.
|
||||
///\param stream - IN: File pointer
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Description:
|
||||
// This function can be removed in next major release.
|
||||
// -BMR, 2014/04/24
|
||||
//--------------------------------------------------------------------------
|
||||
void Exception::printError(FILE* stream) const
|
||||
{
|
||||
Exception::printErrorStack(stream, H5E_DEFAULT);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -312,7 +335,7 @@ void Exception::printError( FILE* stream ) const
|
||||
///\brief Noop destructor
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
Exception::~Exception() {}
|
||||
Exception::~Exception() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: FileIException
|
||||
@@ -327,15 +350,15 @@ FileIException::FileIException():Exception(){}
|
||||
// Function: FileIException overloaded constructor
|
||||
///\brief Creates a FileIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
FileIException::FileIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
FileIException::FileIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
FileIException::~FileIException() {}
|
||||
FileIException::~FileIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: GroupIException
|
||||
@@ -350,15 +373,15 @@ GroupIException::GroupIException():Exception(){}
|
||||
// Function: GroupIException overloaded constructor
|
||||
///\brief Creates a GroupIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
GroupIException::GroupIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
GroupIException::GroupIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: GroupIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
GroupIException::~GroupIException() {}
|
||||
GroupIException::~GroupIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: DataSpaceIException
|
||||
@@ -373,15 +396,15 @@ DataSpaceIException::DataSpaceIException():Exception(){}
|
||||
// Function: DataSpaceIException overloaded constructor
|
||||
///\brief Creates a DataSpaceIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
DataSpaceIException::DataSpaceIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
DataSpaceIException::DataSpaceIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSpaceIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
DataSpaceIException::~DataSpaceIException() {}
|
||||
DataSpaceIException::~DataSpaceIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: DataTypeIException
|
||||
@@ -396,15 +419,15 @@ DataTypeIException::DataTypeIException():Exception(){}
|
||||
// Function: DataTypeIException overloaded constructor
|
||||
///\brief Creates a DataTypeIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
DataTypeIException::DataTypeIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
DataTypeIException::DataTypeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataTypeIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
DataTypeIException::~DataTypeIException() {}
|
||||
DataTypeIException::~DataTypeIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: PropListIException
|
||||
@@ -419,15 +442,15 @@ PropListIException::PropListIException():Exception(){}
|
||||
// Function: PropListIException overloaded constructor
|
||||
///\brief Creates a PropListIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
PropListIException::PropListIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
PropListIException::PropListIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: PropListIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
PropListIException::~PropListIException() {}
|
||||
PropListIException::~PropListIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: DataSetIException
|
||||
@@ -442,15 +465,15 @@ DataSetIException::DataSetIException():Exception(){}
|
||||
// Function: DataSetIException overloaded constructor
|
||||
///\brief Creates a DataSetIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
DataSetIException::DataSetIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
DataSetIException::DataSetIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: DataSetIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
DataSetIException::~DataSetIException() {}
|
||||
DataSetIException::~DataSetIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: AttributeIException
|
||||
@@ -465,15 +488,15 @@ AttributeIException::AttributeIException():Exception(){}
|
||||
// Function: AttributeIException overloaded constructor
|
||||
///\brief Creates an AttributeIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
AttributeIException::AttributeIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
AttributeIException::AttributeIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: AttributeIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
AttributeIException::~AttributeIException() {}
|
||||
AttributeIException::~AttributeIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: ReferenceException
|
||||
@@ -488,15 +511,15 @@ ReferenceException::ReferenceException():Exception(){}
|
||||
// Function: ReferenceException overloaded constructor
|
||||
///\brief Creates a ReferenceException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
ReferenceException::ReferenceException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
ReferenceException::ReferenceException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: ReferenceException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
ReferenceException::~ReferenceException() {}
|
||||
ReferenceException::~ReferenceException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: LibraryIException
|
||||
@@ -511,15 +534,38 @@ LibraryIException::LibraryIException():Exception(){}
|
||||
// Function: LibraryIException overloaded constructor
|
||||
///\brief Creates a LibraryIException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
LibraryIException::LibraryIException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
LibraryIException::LibraryIException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: LibraryIException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
LibraryIException::~LibraryIException() {}
|
||||
LibraryIException::~LibraryIException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: LocationException
|
||||
// Programmer Binh-Minh Ribler - 2014
|
||||
//--------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: LocationException default constructor
|
||||
///\brief Default constructor.
|
||||
//--------------------------------------------------------------------------
|
||||
LocationException::LocationException():Exception(){}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: LocationException overloaded constructor
|
||||
///\brief Creates a LocationException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
LocationException::LocationException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: LocationException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
LocationException::~LocationException() throw() {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Subclass: IdComponentException
|
||||
@@ -534,15 +580,15 @@ IdComponentException::IdComponentException(): Exception() {}
|
||||
// Function: IdComponentException overloaded constructor
|
||||
///\brief Creates a IdComponentException with the name of the function,
|
||||
/// in which the failure occurs, and an optional detailed message.
|
||||
///\param func_name - IN: Name of the function where failure occurs
|
||||
///\param func - IN: Name of the function where failure occurs
|
||||
///\param message - IN: Message on the failure
|
||||
//--------------------------------------------------------------------------
|
||||
IdComponentException::IdComponentException(const H5std_string& func_name, const H5std_string& message) : Exception(func_name, message) {}
|
||||
IdComponentException::IdComponentException(const H5std_string& func, const H5std_string& message) : Exception(func, message) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: IdComponentException destructor
|
||||
///\brief Noop destructor.
|
||||
//--------------------------------------------------------------------------
|
||||
IdComponentException::~IdComponentException() {}
|
||||
IdComponentException::~IdComponentException() throw() {}
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
} // end namespace
|
||||
#endif
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5Exception_H
|
||||
#define _H5Exception_H
|
||||
#ifndef __H5Exception_H
|
||||
#define __H5Exception_H
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -28,6 +28,11 @@ namespace H5 {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*! \class Exception
|
||||
\brief Exception provides wrappers of HDF5 error handling functions.
|
||||
|
||||
Many classes are derived from Exception for specific HDF5 C interfaces.
|
||||
*/
|
||||
class H5_DLLCPP Exception {
|
||||
public:
|
||||
// Creates an exception with a function name where the failure occurs
|
||||
@@ -67,7 +72,9 @@ class H5_DLLCPP Exception {
|
||||
H5E_walk2_t func, void* client_data);
|
||||
|
||||
// Prints the error stack in a default manner.
|
||||
virtual void printError( FILE* stream = NULL ) const;
|
||||
static void printErrorStack(FILE* stream = stderr,
|
||||
hid_t err_stack = H5E_DEFAULT); // Static
|
||||
virtual void printError(FILE* stream = NULL) const;
|
||||
|
||||
// Default constructor
|
||||
Exception();
|
||||
@@ -76,89 +83,96 @@ class H5_DLLCPP Exception {
|
||||
Exception( const Exception& orig);
|
||||
|
||||
// virtual Destructor
|
||||
virtual ~Exception();
|
||||
virtual ~Exception() throw();
|
||||
|
||||
protected:
|
||||
// Default value for detail_message
|
||||
static const char DEFAULT_MSG[];
|
||||
|
||||
private:
|
||||
H5std_string detail_message;
|
||||
H5std_string func_name;
|
||||
|
||||
protected:
|
||||
// Default value for detail_message
|
||||
static const H5std_string DEFAULT_MSG;
|
||||
};
|
||||
|
||||
class H5_DLLCPP FileIException : public Exception {
|
||||
public:
|
||||
FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
FileIException();
|
||||
virtual ~FileIException();
|
||||
virtual ~FileIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP GroupIException : public Exception {
|
||||
public:
|
||||
GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
GroupIException();
|
||||
virtual ~GroupIException();
|
||||
virtual ~GroupIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP DataSpaceIException : public Exception {
|
||||
public:
|
||||
DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
DataSpaceIException();
|
||||
virtual ~DataSpaceIException();
|
||||
virtual ~DataSpaceIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP DataTypeIException : public Exception {
|
||||
public:
|
||||
DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
DataTypeIException();
|
||||
virtual ~DataTypeIException();
|
||||
virtual ~DataTypeIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP PropListIException : public Exception {
|
||||
public:
|
||||
PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
PropListIException();
|
||||
virtual ~PropListIException();
|
||||
virtual ~PropListIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP DataSetIException : public Exception {
|
||||
public:
|
||||
DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
DataSetIException();
|
||||
virtual ~DataSetIException();
|
||||
virtual ~DataSetIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP AttributeIException : public Exception {
|
||||
public:
|
||||
AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
AttributeIException();
|
||||
virtual ~AttributeIException();
|
||||
virtual ~AttributeIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP ReferenceException : public Exception {
|
||||
public:
|
||||
ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
ReferenceException();
|
||||
virtual ~ReferenceException();
|
||||
virtual ~ReferenceException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP LibraryIException : public Exception {
|
||||
public:
|
||||
LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
LibraryIException();
|
||||
virtual ~LibraryIException();
|
||||
virtual ~LibraryIException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP LocationException : public Exception {
|
||||
public:
|
||||
LocationException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
LocationException();
|
||||
virtual ~LocationException() throw();
|
||||
};
|
||||
|
||||
class H5_DLLCPP IdComponentException : public Exception {
|
||||
public:
|
||||
IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
|
||||
IdComponentException();
|
||||
virtual ~IdComponentException();
|
||||
virtual ~IdComponentException() throw();
|
||||
};
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _H5Exception_H
|
||||
#endif // __H5Exception_H
|
||||
|
||||
@@ -40,10 +40,10 @@ FileAccPropList::FileAccPropList() : PropList( H5P_FILE_ACCESS ) {}
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList copy constructor
|
||||
///\brief Copy Constructor: makes a copy of the original
|
||||
/// FileAccPropList object.
|
||||
///\param original - IN: FileAccPropList instance to copy
|
||||
// Programmer: Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
FileAccPropList::FileAccPropList(const FileAccPropList& orig) : PropList(orig) {}
|
||||
FileAccPropList::FileAccPropList(const FileAccPropList& original) : PropList(original) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList overloaded constructor
|
||||
@@ -76,7 +76,7 @@ void FileAccPropList::setStdio() const
|
||||
/// driver was set for the property list. The driver ID is
|
||||
/// only valid as long as the file driver remains registered.
|
||||
/// Valid driver identifiers can be found at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetDriver
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetDriver
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -99,7 +99,7 @@ hid_t FileAccPropList::getDriver() const
|
||||
///\par Description
|
||||
/// For a list of valid driver identifiers, please see the C
|
||||
/// layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetDriver
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetDriver
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const
|
||||
@@ -157,7 +157,7 @@ hsize_t FileAccPropList::getFamilyOffset() const
|
||||
///\par Description
|
||||
/// For more details on the use of \c H5FD_CORE driver, please
|
||||
/// refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplCore
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplCore
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setCore (size_t increment, hbool_t backing_store) const
|
||||
@@ -261,10 +261,10 @@ FileAccPropList FileAccPropList::getFamily(hsize_t& memb_size) const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Temporary - For information, please refer to:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplSplit
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplSplit
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
|
||||
void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
|
||||
{
|
||||
hid_t meta_pid = meta_plist.getId();
|
||||
hid_t raw_pid = raw_plist.getId();
|
||||
@@ -275,64 +275,61 @@ void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& ra
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSplit
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\param meta_plist - IN: File access plist for the metadata file
|
||||
///\param raw_plist - IN: File access plist for the raw data file
|
||||
///\param meta_ext - IN: Metadata filename extension as \c char*
|
||||
///\param raw_ext - IN: Raw data filename extension as \c char*
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
// Note: Retiring April, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const
|
||||
{
|
||||
setSplit((const FileAccPropList)meta_plist, (const FileAccPropList)raw_plist, meta_ext, raw_ext);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSplit
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It differs from the above function only in what arguments it
|
||||
/// accepts.
|
||||
/// It takes character arguments as \c H5std_string.
|
||||
///\param meta_plist - IN: File access plist for the metadata file
|
||||
///\param raw_plist - IN: File access plist for the raw data file
|
||||
///\param meta_ext - IN: Metadata filename extension as \c H5std_string
|
||||
///\param raw_ext - IN: Raw data filename extension as \c H5std_string
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
|
||||
{
|
||||
setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setSplit
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const's. This wrapper will be removed in future release.
|
||||
///\param meta_plist - IN: File access plist for the metadata file
|
||||
///\param raw_plist - IN: File access plist for the raw data file
|
||||
///\param meta_ext - IN: Metadata filename extension as \c string
|
||||
///\param raw_ext - IN: Raw data filename extension as \c string
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
// Note: Retiring April, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
|
||||
void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const
|
||||
{
|
||||
setSplit( meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() );
|
||||
setSplit((const FileAccPropList)meta_plist, (const FileAccPropList)raw_plist, meta_ext.c_str(), raw_ext.c_str() );
|
||||
}
|
||||
|
||||
#ifdef H5_HAVE_STREAM // for Stream Virtual File Driver
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getStream
|
||||
///\brief Retrieves the streaming I/O driver settings
|
||||
///\return The streaming I/O file access property list structure
|
||||
/// For detail on this structure, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
///\exception H5::PropListIException
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5FD_stream_fapl_t FileAccPropList::getStream() const
|
||||
{
|
||||
H5FD_stream_fapl_t fapl;
|
||||
herr_t ret_value = H5Pget_fapl_stream(id, &fapl);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getStream", "H5Pget_fapl_stream failed");
|
||||
}
|
||||
return(fapl);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setStream
|
||||
///\brief Modifies this file access property list to use the Stream
|
||||
/// driver.
|
||||
///\param fapl - IN: The streaming I/O file access property list
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on \a fapl, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setStream(H5FD_stream_fapl_t &fapl) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_fapl_stream (id, &fapl);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setStream", "H5Pset_fapl_stream failed");
|
||||
}
|
||||
}
|
||||
#endif // Stream Virtual File Driver
|
||||
// Stream Virtual File Driver had been removed from the main library.
|
||||
// FileAccPropList::[s,g]etStream are now removed from the C++ API.
|
||||
// -BMR, March, 2012
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getSieveBufSize
|
||||
@@ -360,7 +357,7 @@ size_t FileAccPropList::getSieveBufSize() const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on data sieving, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSieveBufSize
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSieveBufSize
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setSieveBufSize(size_t bufsize) const
|
||||
@@ -380,7 +377,7 @@ void FileAccPropList::setSieveBufSize(size_t bufsize) const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For more detail, please see the C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMetaBlockSize
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMetaBlockSize
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const
|
||||
@@ -420,7 +417,7 @@ hsize_t FileAccPropList::getMetaBlockSize() const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on \a flags, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFaplLog
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const
|
||||
@@ -477,7 +474,7 @@ void FileAccPropList::setSec2() const
|
||||
/// The parameter \a alignment must have a positive value.
|
||||
///
|
||||
/// For detail on \a setting alignment, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetAlignment
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetAlignment
|
||||
// Programmer: Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setAlignment( hsize_t threshold, hsize_t alignment ) const
|
||||
@@ -514,7 +511,7 @@ void FileAccPropList::getAlignment( hsize_t &threshold, hsize_t &alignment ) con
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// More details and valid values for \a dtype can be found at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetMultiType
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetMultiType
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
|
||||
@@ -533,7 +530,7 @@ void FileAccPropList::setMultiType(H5FD_mem_t dtype) const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// More details and possible returned values can be found at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-GetMultiType
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetMultiType
|
||||
// Programmer: Binh-Minh Ribler - April, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5FD_mem_t FileAccPropList::getMultiType() const
|
||||
@@ -634,7 +631,7 @@ H5F_close_degree_t FileAccPropList::getFcloseDegree()
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For detail on \a fapl, please refer to
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetFaplStream
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetGCReferences
|
||||
// Programmer: Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setGcReferences( unsigned gc_ref ) const
|
||||
@@ -666,6 +663,67 @@ unsigned FileAccPropList::getGcReferences() const
|
||||
return( gc_ref );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::setLibverBounds
|
||||
///\brief Sets bounds on versions of library format to be used when creating
|
||||
/// or writing objects.
|
||||
///\param libver_low - IN: Earliest version of the library that will be
|
||||
/// used for creating or writing objects
|
||||
///\param libver_high - IN: Latest version of the library that will be
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// Valid values of \a libver_low are as follows:
|
||||
/// \li \c H5F_LIBVER_EARLIEST (Default)
|
||||
/// \li \c H5F_LIBVER_18
|
||||
/// \li \c H5F_LIBVER_LATEST
|
||||
///
|
||||
/// Valid values of \a libver_high are as follows:
|
||||
/// \li \c H5F_LIBVER_18
|
||||
/// \li \c H5F_LIBVER_LATEST (Default)
|
||||
///
|
||||
/// For more details, please refer to
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetLibverBounds
|
||||
// Programmer: Binh-Minh Ribler - March, 2015
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const
|
||||
{
|
||||
herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high);
|
||||
if (ret_value < 0)
|
||||
{
|
||||
throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList::getLibverBounds
|
||||
///\brief Gets the current settings for the library version format bounds
|
||||
/// from a file access property list.
|
||||
///\param libver_low - OUT: Earliest version of the library that will be
|
||||
/// used for creating or writing objects
|
||||
///\param libver_high - OUT: Latest version of the library that will be
|
||||
/// used for creating or writing objects
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// On success, the argument \a libver_low can have the following
|
||||
/// values:
|
||||
/// \li \c H5F_LIBVER_EARLIEST
|
||||
/// \li \c H5F_LIBVER_18
|
||||
/// \li \c H5F_LIBVER_LATEST
|
||||
///
|
||||
/// and \a libver_high:
|
||||
/// \li \c H5F_LIBVER_18
|
||||
/// \li \c H5F_LIBVER_LATEST
|
||||
// Programmer: Binh-Minh Ribler - March, 2015
|
||||
//--------------------------------------------------------------------------
|
||||
void FileAccPropList::getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const
|
||||
{
|
||||
herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high);
|
||||
if( ret_value < 0 )
|
||||
{
|
||||
throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileAccPropList destructor
|
||||
///\brief Noop destructor
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5FileAccPropList_H
|
||||
#define _H5FileAccPropList_H
|
||||
#ifndef __H5FileAccPropList_H
|
||||
#define __H5FileAccPropList_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// class for file access properties
|
||||
//! Class FileAccPropList represents the HDF5 file access property list.
|
||||
class H5_DLLCPP FileAccPropList : public PropList {
|
||||
public:
|
||||
static const FileAccPropList DEFAULT;
|
||||
@@ -62,18 +62,21 @@ class H5_DLLCPP FileAccPropList : public PropList {
|
||||
FileAccPropList getFamily(hsize_t& memb_size) const;
|
||||
|
||||
// Emulates the old split file driver,
|
||||
void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
const char* meta_ext = ".meta", const char* raw_ext = ".raw" ) const;
|
||||
void setSplit( FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
const H5std_string& meta_ext, const H5std_string& raw_ext ) const;
|
||||
|
||||
#ifdef H5_HAVE_STREAM // for Stream Virtual File Driver
|
||||
// Modifies this file access property list to use the Stream driver.
|
||||
void setStream(H5FD_stream_fapl_t &fapl) const;
|
||||
|
||||
// Retrieves the streaming I/O driver settings
|
||||
H5FD_stream_fapl_t getStream() const;
|
||||
#endif
|
||||
void setSplit(const FileAccPropList& meta_plist,
|
||||
const FileAccPropList& raw_plist,
|
||||
const char* meta_ext = ".meta",
|
||||
const char* raw_ext = ".raw" ) const;
|
||||
void setSplit(const FileAccPropList& meta_plist,
|
||||
const FileAccPropList& raw_plist,
|
||||
const H5std_string& meta_ext = ".meta",
|
||||
const H5std_string& raw_ext = ".raw") const;
|
||||
// These two overloaded functions are kept for backward compatibility
|
||||
// only; they missed the const's and will be removed in future release.
|
||||
void setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
const char* meta_ext=".meta", const char* raw_ext=".raw") const;
|
||||
void setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist,
|
||||
const H5std_string& meta_ext=".meta",
|
||||
const H5std_string& raw_ext=".raw") const;
|
||||
|
||||
// Sets the maximum size of the data sieve buffer.
|
||||
void setSieveBufSize(size_t bufsize) const;
|
||||
@@ -123,7 +126,14 @@ class H5_DLLCPP FileAccPropList : public PropList {
|
||||
// Returns garbage collecting references setting.
|
||||
unsigned getGcReferences() const;
|
||||
|
||||
// Returns this class name
|
||||
// Sets bounds on versions of library format to be used when creating
|
||||
// or writing objects.
|
||||
void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const;
|
||||
|
||||
// Gets the current settings for the library version format bounds.
|
||||
void getLibverBounds(H5F_libver_t& libver_low, H5F_libver_t& libver_high) const;
|
||||
|
||||
///\brief Returns this class name.
|
||||
virtual H5std_string fromClass () const { return("FileAccPropList"); }
|
||||
|
||||
// Copy constructor: creates a copy of a FileAccPropList object.
|
||||
@@ -139,4 +149,4 @@ class H5_DLLCPP FileAccPropList : public PropList {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5FileAccPropList_H
|
||||
|
||||
@@ -55,6 +55,7 @@ FileCreatPropList::FileCreatPropList( const FileCreatPropList& original ) : Prop
|
||||
//--------------------------------------------------------------------------
|
||||
FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::getVersion
|
||||
///\brief Retrieves version information for various parts of a file.
|
||||
@@ -76,6 +77,7 @@ void FileCreatPropList::getVersion(unsigned& super, unsigned& freelist, unsigned
|
||||
"H5Pget_version failed");
|
||||
}
|
||||
}
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: FileCreatPropList::setUserblock
|
||||
@@ -126,7 +128,7 @@ hsize_t FileCreatPropList::getUserblock() const
|
||||
///\par Description
|
||||
/// For information on setting sizes, please refer to the
|
||||
/// C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSizes
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSizes
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void FileCreatPropList::setSizes( size_t sizeof_addr, size_t sizeof_size ) const
|
||||
@@ -166,7 +168,7 @@ void FileCreatPropList::getSizes( size_t& sizeof_addr, size_t& sizeof_size ) con
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information, please see the C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSymK
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSymK
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void FileCreatPropList::setSymk( unsigned ik, unsigned lk ) const
|
||||
@@ -187,7 +189,7 @@ void FileCreatPropList::setSymk( unsigned ik, unsigned lk ) const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information, please see
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetSymK
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetSymK
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void FileCreatPropList::getSymk( unsigned& ik, unsigned& lk ) const
|
||||
@@ -208,7 +210,7 @@ void FileCreatPropList::getSymk( unsigned& ik, unsigned& lk ) const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information, please see the C layer Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetIstoreK
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetIstoreK
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void FileCreatPropList::setIstorek( unsigned ik ) const
|
||||
@@ -228,7 +230,7 @@ void FileCreatPropList::setIstorek( unsigned ik ) const
|
||||
///\exception H5::PropListIException
|
||||
///\par Description
|
||||
/// For information, please see
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5P.html#Property-SetIstoreK
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-GetIstoreK
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
unsigned FileCreatPropList::getIstorek() const
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5FileCreatPropList_H
|
||||
#define _H5FileCreatPropList_H
|
||||
#ifndef __H5FileCreatPropList_H
|
||||
#define __H5FileCreatPropList_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
// class for file access properties
|
||||
//! Class FileCreatPropList represents the HDF5 file create property list.
|
||||
class H5_DLLCPP FileCreatPropList : public PropList {
|
||||
public:
|
||||
// Default file creation property list.
|
||||
@@ -30,8 +30,10 @@ class H5_DLLCPP FileCreatPropList : public PropList {
|
||||
// Creates a file create property list.
|
||||
FileCreatPropList();
|
||||
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
// Retrieves version information for various parts of a file.
|
||||
void getVersion( unsigned& super, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const;
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
|
||||
// Sets the userblock size field of a file creation property list.
|
||||
void setUserblock( hsize_t size ) const;
|
||||
@@ -60,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.
|
||||
@@ -76,4 +78,4 @@ class H5_DLLCPP FileCreatPropList : public PropList {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5FileCreatPropList_H
|
||||
|
||||
@@ -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(), CommonFG(), id(H5I_INVALID_HID) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File overloaded constructor
|
||||
@@ -61,7 +61,7 @@ H5File::H5File() : IdComponent(), id(0) {}
|
||||
/// modifying default file meta-data. Default to
|
||||
/// FileCreatPropList::DEFAULT
|
||||
///\param access_plist - IN: File access property list. Default to
|
||||
/// FileCreatPropList::DEFAULT
|
||||
/// FileAccPropList::DEFAULT
|
||||
///\par Description
|
||||
/// Valid values of \a flags include:
|
||||
/// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists,
|
||||
@@ -69,70 +69,110 @@ H5File::H5File() : IdComponent(), id(0) {}
|
||||
/// the file.
|
||||
/// \li \c H5F_ACC_EXCL - Fail if file already exists.
|
||||
/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive
|
||||
/// \li \c H5F_ACC_DEBUG - print debug information. This flag is
|
||||
/// used only by HDF5 library developers; it is neither
|
||||
/// tested nor supported for use in applications.
|
||||
/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already
|
||||
/// exists, and fail, otherwise
|
||||
/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already
|
||||
/// exists, and fail, otherwise
|
||||
///\par
|
||||
/// For info on file creation in the case of an already-open file,
|
||||
/// please refer to the \b Special \b case section in the C layer
|
||||
/// Reference Manual at:
|
||||
/// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5F.html#File-Create
|
||||
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create
|
||||
// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file
|
||||
// could not be caught in the applications. Added try block here
|
||||
// to catch then re-throw it. -BMR 2013/03/21
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
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(), CommonFG(), id(H5I_INVALID_HID)
|
||||
{
|
||||
p_get_file(name, flags, create_plist, access_plist);
|
||||
try {
|
||||
p_get_file(name, flags, create_plist, access_plist);
|
||||
} catch (FileIException open_file) {
|
||||
throw open_file;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File overloaded constructor
|
||||
///\brief This is another overloaded constructor. It differs from the
|
||||
/// above constructor only in the type of the \a name argument.
|
||||
///\param name - IN: Name of the file - \c std::string
|
||||
///\param name - IN: Name of the file - \c H5std_string
|
||||
///\param flags - IN: File access flags
|
||||
///\param create_plist - IN: File creation property list, used when
|
||||
/// modifying default file meta-data. Default to
|
||||
/// FileCreatPropList::DEFAULT
|
||||
///\param access_plist - IN: File access property list. Default to
|
||||
/// FileCreatPropList::DEFAULT
|
||||
/// FileAccPropList::DEFAULT
|
||||
// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file
|
||||
// could not be caught in the applications. Added try block here
|
||||
// to catch then re-throw it. -BMR 2013/03/21
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
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(), CommonFG(), id(H5I_INVALID_HID)
|
||||
{
|
||||
p_get_file(name.c_str(), flags, create_plist, access_plist);
|
||||
try {
|
||||
p_get_file(name.c_str(), flags, create_plist, access_plist);
|
||||
} catch (FileIException open_file) {
|
||||
throw open_file;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// This function is private and contains common code between the
|
||||
// constructors taking a string or a char*
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// - removed H5F_ACC_CREAT because H5Fcreate will fail with
|
||||
// H5F_ACC_CREAT. - BMR, Sep 17, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist)
|
||||
{
|
||||
// These bits only set for creation, so if any of them are set,
|
||||
// create the file.
|
||||
if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
|
||||
if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC))
|
||||
{
|
||||
hid_t create_plist_id = create_plist.getId();
|
||||
hid_t access_plist_id = access_plist.getId();
|
||||
id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
|
||||
if( id < 0 ) // throw an exception when open/create fail
|
||||
{
|
||||
throw FileIException("H5File constructor", "H5Fcreate failed");
|
||||
}
|
||||
hid_t create_plist_id = create_plist.getId();
|
||||
hid_t access_plist_id = access_plist.getId();
|
||||
id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
|
||||
if( id < 0 ) // throw an exception when open/create fail
|
||||
{
|
||||
throw FileIException("H5File constructor", "H5Fcreate failed");
|
||||
}
|
||||
}
|
||||
// Open the file if none of the bits above are set.
|
||||
else
|
||||
{
|
||||
hid_t access_plist_id = access_plist.getId();
|
||||
id = H5Fopen( name, flags, access_plist_id );
|
||||
if( id < 0 ) // throw an exception when open/create fail
|
||||
{
|
||||
throw FileIException("H5File constructor", "H5Fopen failed");
|
||||
}
|
||||
hid_t access_plist_id = access_plist.getId();
|
||||
id = H5Fopen( name, flags, access_plist_id );
|
||||
if( id < 0 ) // throw an exception when open/create fail
|
||||
{
|
||||
throw FileIException("H5File constructor", "H5Fopen failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File overloaded constructor
|
||||
///\brief Creates an H5File object using an existing file id.
|
||||
///\param existing_id - IN: Id of an existing file
|
||||
// Programmer Binh-Minh Ribler - 2015
|
||||
// Description
|
||||
// Mar 29, 2015
|
||||
// Added in responding to a request from user Jason Newton.
|
||||
// However, it is not recommended to use the private member "id"
|
||||
// in applications. Unlike other situations, where similar
|
||||
// constructor is needed by the library in order to return
|
||||
// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially)
|
||||
//--------------------------------------------------------------------------
|
||||
H5File::H5File(hid_t existing_id) : H5Location(), CommonFG()
|
||||
{
|
||||
id = existing_id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File copy constructor
|
||||
///\brief Copy constructor: makes a copy of the original
|
||||
@@ -140,34 +180,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(), CommonFG()
|
||||
{
|
||||
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.
|
||||
// Function: H5File::isHdf5 (static)
|
||||
///\brief Determines whether a file in HDF5 format. (Static)
|
||||
///\param name - IN: Name of the file
|
||||
///\return true if the file is in HDF5 format, and false, otherwise
|
||||
///\exception H5::FileIException
|
||||
@@ -189,10 +210,10 @@ bool H5File::isHdf5(const char* name)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::isHdf5
|
||||
// Function: H5File::isHdf5 (static)
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes an \c std::string for \a name.
|
||||
///\param name - IN: Name of the file - \c std::string
|
||||
/// It takes an \c H5std_string for \a name. (Static)
|
||||
///\param name - IN: Name of the file - \c H5std_string
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
bool H5File::isHdf5(const H5std_string& name )
|
||||
@@ -206,7 +227,7 @@ bool H5File::isHdf5(const H5std_string& name )
|
||||
///\param name - IN: Name of the file
|
||||
///\param flags - IN: File access flags
|
||||
///\param access_plist - IN: File access property list. Default to
|
||||
/// FileCreatPropList::DEFAULT
|
||||
/// FileAccPropList::DEFAULT
|
||||
///\par Description
|
||||
/// Valid values of \a flags include:
|
||||
/// H5F_ACC_RDWR: Open with read/write access. If the file is
|
||||
@@ -220,6 +241,13 @@ bool H5File::isHdf5(const H5std_string& name )
|
||||
//--------------------------------------------------------------------------
|
||||
void H5File::openFile(const char* name, unsigned int flags, const FileAccPropList& access_plist)
|
||||
{
|
||||
try {
|
||||
close();
|
||||
}
|
||||
catch (Exception close_error) {
|
||||
throw FileIException("H5File::openFile", close_error.getDetailMsg());
|
||||
}
|
||||
|
||||
hid_t access_plist_id = access_plist.getId();
|
||||
id = H5Fopen (name, flags, access_plist_id);
|
||||
if (id < 0) // throw an exception when open fails
|
||||
@@ -231,8 +259,8 @@ void H5File::openFile(const char* name, unsigned int flags, const FileAccPropLis
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::openFile
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes an \c std::string for \a name.
|
||||
///\param name - IN: Name of the file - \c std::string
|
||||
/// It takes an \c H5std_string for \a name.
|
||||
///\param name - IN: Name of the file - \c H5std_string
|
||||
///\param flags - IN: File access flags
|
||||
///\param access_plist - IN: File access property list. Default to
|
||||
/// FileAccPropList::DEFAULT
|
||||
@@ -269,28 +297,13 @@ 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");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void H5File::reopen()
|
||||
{
|
||||
H5File::reOpen();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getCreatePlist
|
||||
///\brief Returns the creation property list of this file
|
||||
@@ -388,25 +401,6 @@ ssize_t H5File::getObjCount(unsigned types) const
|
||||
return (num_objs);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getObjCount
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
/// It takes no parameter and returns the object count of all
|
||||
/// object types.
|
||||
///\return Number of opened object IDs
|
||||
///\exception H5::FileIException
|
||||
// Programmer Binh-Minh Ribler - May 2004
|
||||
//--------------------------------------------------------------------------
|
||||
ssize_t H5File::getObjCount() const
|
||||
{
|
||||
ssize_t num_objs = H5Fget_obj_count(id, H5F_OBJ_ALL);
|
||||
if( num_objs < 0 )
|
||||
{
|
||||
throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed");
|
||||
}
|
||||
return (num_objs);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getObjIDs
|
||||
///\brief Retrieves a list of opened object IDs (files, datasets,
|
||||
@@ -460,7 +454,7 @@ void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const
|
||||
/// closed and reopened or opened during a subsequent session.
|
||||
// Programmer Binh-Minh Ribler - May 2004
|
||||
//--------------------------------------------------------------------------
|
||||
void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
|
||||
void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const
|
||||
{
|
||||
hid_t fapl_id = fapl.getId();
|
||||
herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle);
|
||||
@@ -470,6 +464,23 @@ void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getVFDHandle
|
||||
///\brief This is an overloaded member function, kept for backward
|
||||
/// compatibility. It differs from the above function in that it
|
||||
/// misses const. This wrapper will be removed in future release.
|
||||
///\param fapl - File access property list
|
||||
///\param file_handle - Pointer to the file handle being used by
|
||||
/// the low-level virtual file driver
|
||||
///\exception H5::FileIException
|
||||
// Programmer Binh-Minh Ribler - May 2004
|
||||
// Note: Retiring April, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const
|
||||
{
|
||||
getVFDHandle((const FileAccPropList)fapl, file_handle);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getVFDHandle
|
||||
///\brief This is an overloaded member function, provided for convenience.
|
||||
@@ -489,70 +500,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 \tReference is an object reference.
|
||||
/// \li \c H5R_DATASET_REGION \tReference 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.
|
||||
@@ -575,133 +522,23 @@ hsize_t H5File::getFileSize() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// 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
|
||||
// Function: H5File::getId
|
||||
///\brief Get the id of this file
|
||||
///\return File identifier
|
||||
// Modification:
|
||||
// May 2008 - BMR
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
// AbstractDS and Attribute are moved out of H5Object. In
|
||||
// addition, member IdComponent::id is moved into subclasses, and
|
||||
// IdComponent::getId now becomes pure virtual function.
|
||||
// Programmer Binh-Minh Ribler - May, 2008
|
||||
//--------------------------------------------------------------------------
|
||||
void H5File::p_reference(void* ref, const char* name, hid_t space_id, H5R_type_t ref_type) const
|
||||
hid_t H5File::getId() 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 \tReference is an object reference.
|
||||
/// \li \c H5R_DATASET_REGION \tReference 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 std::string for the object's name.
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param name - IN: Name of the object to be referenced - \c std::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);
|
||||
return(id);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getLocId
|
||||
// Purpose: Get the id of this file
|
||||
@@ -716,23 +553,20 @@ hid_t H5File::getLocId() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::getId
|
||||
// Purpose: Get the id of this attribute
|
||||
// Modification:
|
||||
// May 2008 - BMR
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
// AbstractDS and Attribute are moved out of H5Object. In
|
||||
// addition, member IdComponent::id is moved into subclasses, and
|
||||
// IdComponent::getId now becomes pure virtual function.
|
||||
// Programmer Binh-Minh Ribler - May, 2008
|
||||
// Function: H5File::reopen
|
||||
// Purpose: Reopens this file.
|
||||
// Exception H5::FileIException
|
||||
// Description
|
||||
// This function is replaced by the above function reOpen.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
hid_t H5File::getId() const
|
||||
void H5File::reopen()
|
||||
{
|
||||
return(id);
|
||||
H5File::reOpen();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::p_setId
|
||||
// Function: H5File::p_setId (protected)
|
||||
///\brief Sets the identifier of this object to a new value.
|
||||
///
|
||||
///\exception H5::IdComponentException when the attempt to close the HDF5
|
||||
@@ -755,6 +589,7 @@ void H5File::p_setId(const hid_t new_id)
|
||||
// reset object's id to the given id
|
||||
id = new_id;
|
||||
}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: H5File::close
|
||||
@@ -772,10 +607,8 @@ void H5File::close()
|
||||
{
|
||||
throw FileIException("H5File::close", "H5Fclose failed");
|
||||
}
|
||||
// reset the id when the file that it represents is no longer
|
||||
// referenced
|
||||
if (getCounter() == 0)
|
||||
id = 0;
|
||||
// reset the id
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,19 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5File_H
|
||||
#define _H5File_H
|
||||
#ifndef __H5File_H
|
||||
#define __H5File_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
class H5_DLLCPP H5File : public IdComponent, public CommonFG {
|
||||
/*! \class H5File
|
||||
\brief Class H5File represents an HDF5 file.
|
||||
|
||||
It inherits from H5Location and 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 +45,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;
|
||||
|
||||
@@ -60,24 +59,16 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
|
||||
|
||||
// Returns the number of opened object IDs (files, datasets, groups
|
||||
// and datatypes) in the same file.
|
||||
ssize_t getObjCount(unsigned types) const;
|
||||
ssize_t getObjCount() const;
|
||||
ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const;
|
||||
|
||||
// Retrieves a list of opened object IDs (files, datasets, groups
|
||||
// and datatypes) in the same file.
|
||||
void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const;
|
||||
|
||||
#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 the pointer to the file handle of the low-level file driver.
|
||||
void getVFDHandle(FileAccPropList& fapl, void **file_handle) const;
|
||||
void getVFDHandle(void **file_handle) const;
|
||||
void getVFDHandle(const FileAccPropList& fapl, void **file_handle) const;
|
||||
void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // kept for backward compatibility
|
||||
|
||||
// Determines if a file, specified by its name, is in HDF5 format
|
||||
static bool isHdf5(const char* name );
|
||||
@@ -85,24 +76,25 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
|
||||
|
||||
// Reopens this file.
|
||||
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;
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
void reopen(); // obsolete in favor of reOpen()
|
||||
|
||||
// Returns this class name
|
||||
// Gets the file id
|
||||
virtual hid_t getLocId() const;
|
||||
|
||||
// Creates an H5File using an existing file id. Not recommended
|
||||
// in applications.
|
||||
H5File(hid_t existing_id);
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
///\brief Returns this class name.
|
||||
virtual H5std_string fromClass () const { return("H5File"); }
|
||||
|
||||
// Throw file exception.
|
||||
virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const;
|
||||
|
||||
// Gets the file id
|
||||
virtual hid_t getLocId() const;
|
||||
|
||||
// Default constructor
|
||||
H5File();
|
||||
|
||||
@@ -115,34 +107,21 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG {
|
||||
// H5File destructor.
|
||||
virtual ~H5File();
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Sets the HDF5 file id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
hid_t id; // HDF5 file id
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
// This function is private and contains common code between the
|
||||
// constructors taking a string or a char*
|
||||
void p_get_file( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist );
|
||||
|
||||
// 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);
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
};
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5File_H
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5FloatType_H
|
||||
#define _H5FloatType_H
|
||||
#ifndef __H5FloatType_H
|
||||
#define __H5FloatType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
//! Class FloatType operates on HDF5 floating point datatype.
|
||||
class H5_DLLCPP FloatType : public AtomType {
|
||||
public:
|
||||
// Creates a floating-point type using a predefined type
|
||||
@@ -53,7 +54,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
|
||||
@@ -71,4 +72,4 @@ class H5_DLLCPP FloatType : public AtomType {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5FloatType_H
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace H5 {
|
||||
///\brief Default constructor: creates a stub Group.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
Group::Group() : H5Object(), id(0) {}
|
||||
Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group copy constructor
|
||||
@@ -59,7 +59,7 @@ Group::Group() : H5Object(), id(0) {}
|
||||
///\param original - IN: Original group to copy
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
Group::Group(const Group& original) : H5Object(original)
|
||||
Group::Group(const Group& original) : H5Object(), CommonFG()
|
||||
{
|
||||
id = original.getId();
|
||||
incRefCount(); // increment number of references to this id
|
||||
@@ -79,53 +79,31 @@ hid_t Group::getLocId() const
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group overloaded constructor
|
||||
///\brief Creates a Group object using the id of an existing group.
|
||||
///\param group_id - IN: Id of an existing group
|
||||
///\param existing_id - IN: Id of an existing group
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
Group::Group(const hid_t existing_id) : H5Object()
|
||||
Group::Group(const hid_t existing_id) : H5Object(), CommonFG()
|
||||
{
|
||||
id = existing_id;
|
||||
incRefCount(); // increment number of references to this id
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 group, creates a Group object
|
||||
///\param obj - IN: Specifying location referenced object is in
|
||||
///\param loc - IN: Specifying location referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\exception H5::ReferenceException
|
||||
///\par Description
|
||||
/// \c obj can be DataSet, Group, or named DataType, that
|
||||
/// \c obj can be DataSet, Group, or named DataType, that
|
||||
/// is a datatype that has been named by DataType::commit.
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
//--------------------------------------------------------------------------
|
||||
Group::Group(H5Object& obj, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
Group::Group(const H5Location& loc, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
id = p_dereference(obj.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("Group constructor - located by an H5Object",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group overload constructor - dereference
|
||||
///\brief Given a reference, ref, to an hdf5 group, creates a Group object
|
||||
///\param h5file - IN: Location referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\exception H5::ReferenceException
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
//--------------------------------------------------------------------------
|
||||
Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
{
|
||||
try {
|
||||
id = p_dereference(h5file.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("Group constructor - located by an H5File",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -134,75 +112,25 @@ Group::Group(H5File& h5file, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
///\param attr - IN: Specifying location where the referenced object is in
|
||||
///\param ref - IN: Reference pointer
|
||||
///\param ref_type - IN: Reference type - default to H5R_OBJECT
|
||||
///\param plist - IN: Property list - default to PropList::DEFAULT
|
||||
///\exception H5::ReferenceException
|
||||
// Programmer Binh-Minh Ribler - Oct, 2006
|
||||
//--------------------------------------------------------------------------
|
||||
Group::Group(Attribute& attr, const void* ref, H5R_type_t ref_type) : H5Object()
|
||||
Group::Group(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID)
|
||||
{
|
||||
try {
|
||||
id = p_dereference(attr.getId(), ref, ref_type);
|
||||
} catch (ReferenceException deref_error) {
|
||||
throw ReferenceException("Group constructor - located by an Attribute",
|
||||
deref_error.getDetailMsg());
|
||||
}
|
||||
}
|
||||
|
||||
#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 \tReference is an object reference.
|
||||
/// \li \c H5R_DATASET_REGION \tReference is a dataset region reference.
|
||||
///\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::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());
|
||||
}
|
||||
id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group::getId
|
||||
// Purpose: Get the id of this attribute
|
||||
///\brief Get the id of this group
|
||||
///\return Group identifier
|
||||
// Modification:
|
||||
// May 2008 - BMR
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
// AbstractDS and Attribute are moved out of H5Object. In
|
||||
// addition, member IdComponent::id is moved into subclasses, and
|
||||
// IdComponent::getId now becomes pure virtual function.
|
||||
// Class hierarchy is revised to address bugzilla 1068. Class
|
||||
// AbstractDS and Attribute are moved out of H5Object. In
|
||||
// addition, member IdComponent::id is moved into subclasses, and
|
||||
// IdComponent::getId now becomes pure virtual function.
|
||||
// Programmer Binh-Minh Ribler - May, 2008
|
||||
//--------------------------------------------------------------------------
|
||||
hid_t Group::getId() const
|
||||
@@ -210,16 +138,17 @@ hid_t Group::getId() const
|
||||
return(id);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group::p_setId
|
||||
///\brief Sets the identifier of this object to a new value.
|
||||
///
|
||||
///\exception H5::IdComponentException when the attempt to close the HDF5
|
||||
/// object fails
|
||||
/// object fails
|
||||
// Description:
|
||||
// The underlaying reference counting in the C library ensures
|
||||
// that the current valid id of this object is properly closed.
|
||||
// Then the object's id is reset to the new id.
|
||||
// The underlaying reference counting in the C library ensures
|
||||
// that the current valid id of this object is properly closed.
|
||||
// Then the object's id is reset to the new id.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
void Group::p_setId(const hid_t new_id)
|
||||
@@ -234,6 +163,7 @@ void Group::p_setId(const hid_t new_id)
|
||||
// reset object's id to the given id
|
||||
id = new_id;
|
||||
}
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: Group::close
|
||||
@@ -251,10 +181,8 @@ void Group::close()
|
||||
{
|
||||
throw GroupIException("Group::close", "H5Gclose failed");
|
||||
}
|
||||
// reset the id when the group that it represents is no longer
|
||||
// referenced
|
||||
if (getCounter() == 0)
|
||||
id = 0;
|
||||
// reset the id
|
||||
id = H5I_INVALID_HID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,27 +14,24 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5Group_H
|
||||
#define _H5Group_H
|
||||
#ifndef __H5Group_H
|
||||
#define __H5Group_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
/*! \class Group
|
||||
\brief Class Group represents an HDF5 group.
|
||||
|
||||
It inherits many operations from H5Location and CommonFG.
|
||||
*/
|
||||
class H5_DLLCPP Group : public H5Object, public CommonFG {
|
||||
public:
|
||||
// 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.
|
||||
@@ -44,9 +41,8 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
|
||||
virtual hid_t getLocId() const;
|
||||
|
||||
// Creates a group by way of dereference.
|
||||
Group(H5Object& obj, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
Group(H5File& h5file, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
Group(Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT);
|
||||
Group(const H5Location& loc, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
|
||||
Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& plist = PropList::DEFAULT);
|
||||
|
||||
// default constructor
|
||||
Group();
|
||||
@@ -63,14 +59,16 @@ class H5_DLLCPP Group : public H5Object, public CommonFG {
|
||||
// Creates a copy of an existing group using its id.
|
||||
Group( const hid_t group_id );
|
||||
|
||||
private:
|
||||
hid_t id; // HDF5 group id
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Sets the group id.
|
||||
virtual void p_setId(const hid_t new_id);
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
private:
|
||||
hid_t id; // HDF5 group id
|
||||
};
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5Group_H
|
||||
|
||||
@@ -13,16 +13,19 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifdef H5_VMS
|
||||
#ifdef OLD_HEADER_FILENAME
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif /*H5_VMS*/
|
||||
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#include "H5Include.h"
|
||||
#include "H5Exception.h"
|
||||
#include "H5Library.h"
|
||||
#include "H5IdComponent.h"
|
||||
#include "H5DataSpace.h"
|
||||
#include "H5private.h" // for HDmemset
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
@@ -34,16 +37,33 @@ namespace H5 {
|
||||
///\param h5_id - IN: Id of an existing object
|
||||
///\exception H5::DataTypeIException
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//
|
||||
// *** Deprecation warning ***
|
||||
// This constructor is no longer appropriate because the data member "id" had
|
||||
// been moved to the sub-classes. It will be removed in 1.10 release. If its
|
||||
// removal does not raise any problems in 1.10, it will be removed from 1.8 in
|
||||
// subsequent releases.
|
||||
//--------------------------------------------------------------------------
|
||||
IdComponent::IdComponent(const hid_t h5_id) {}
|
||||
|
||||
//void IdComponent::p_setId(const hid_t new_id)
|
||||
//{
|
||||
//p_setId(new_id);
|
||||
//}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: IdComponent copy constructor
|
||||
///\brief Copy constructor: makes a copy of the original IdComponent object.
|
||||
///\param original - IN: IdComponent instance to copy
|
||||
// Purpose: This noop copy constructor is removed as a result of the data
|
||||
// member "id" being moved down to sub-classes. (Mar 2015)
|
||||
// Parameters: original - IN: IdComponent instance to copy
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//
|
||||
// *** Deprecation warning ***
|
||||
// This constructor is no longer appropriate because the data member "id" had
|
||||
// been moved to the sub-classes. It is removed from 1.8.15 because it is
|
||||
// a noop and it can be generated by the compiler if needed.
|
||||
//--------------------------------------------------------------------------
|
||||
IdComponent::IdComponent( const IdComponent& original ) {}
|
||||
// IdComponent::IdComponent(const IdComponent& original) {}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: IdComponent::incRefCount
|
||||
@@ -79,12 +99,14 @@ void IdComponent::decRefCount(const hid_t obj_id) const
|
||||
{
|
||||
if (p_valid_id(obj_id))
|
||||
if (H5Idec_ref(obj_id) < 0)
|
||||
{
|
||||
if (H5Iget_ref(obj_id) <= 0)
|
||||
throw IdComponentException(inMemFunc("decRefCount"),
|
||||
"object ref count is 0 or negative");
|
||||
else
|
||||
throw IdComponentException(inMemFunc("decRefCount"),
|
||||
"decrementing object ref count failed");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -127,9 +149,9 @@ int IdComponent::getCounter() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: hdfObjectType
|
||||
// Function: getHDFObjType (static)
|
||||
///\brief Given an id, returns the type of the object.
|
||||
///return a valid HDF object type, which may be one of the following:
|
||||
///\return a valid HDF object type, which may be one of the following:
|
||||
/// \li \c H5I_FILE
|
||||
/// \li \c H5I_GROUP
|
||||
/// \li \c H5I_DATATYPE
|
||||
@@ -142,6 +164,8 @@ int IdComponent::getCounter() const
|
||||
//--------------------------------------------------------------------------
|
||||
H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
|
||||
{
|
||||
if (obj_id <= 0)
|
||||
return H5I_BADID; // invalid
|
||||
H5I_type_t id_type = H5Iget_type(obj_id);
|
||||
if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
|
||||
return H5I_BADID; // invalid
|
||||
@@ -149,6 +173,26 @@ H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
|
||||
return id_type; // valid type
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: getHDFObjType
|
||||
///\brief Returns the type of the object. It is an overloaded function
|
||||
/// of the above function.
|
||||
///\return a valid HDF object type, which may be one of the following:
|
||||
/// \li \c H5I_FILE
|
||||
/// \li \c H5I_GROUP
|
||||
/// \li \c H5I_DATATYPE
|
||||
/// \li \c H5I_DATASPACE
|
||||
/// \li \c H5I_DATASET
|
||||
/// \li \c H5I_ATTR
|
||||
/// \li or \c H5I_BADID, if no valid type can be determined or the
|
||||
/// input object id is invalid.
|
||||
// Programmer Binh-Minh Ribler - Mar, 2014
|
||||
//--------------------------------------------------------------------------
|
||||
H5I_type_t IdComponent::getHDFObjType() const
|
||||
{
|
||||
return(getHDFObjType(getId()));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Function: IdComponent::operator=
|
||||
///\brief Assignment operator.
|
||||
@@ -161,6 +205,10 @@ H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id)
|
||||
// copy the id from rhs to this object, and increment the
|
||||
// reference counter of the id to indicate that another object
|
||||
// is referencing that id.
|
||||
// Modification
|
||||
// 2010/5/9 - BMR
|
||||
// Removed close() and incRefCount() because setId/p_setId takes
|
||||
// care of close() and setId takes care incRefCount().
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
//--------------------------------------------------------------------------
|
||||
IdComponent& IdComponent::operator=( const IdComponent& rhs )
|
||||
@@ -169,16 +217,13 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
|
||||
{
|
||||
// handling references to this id
|
||||
try {
|
||||
close();
|
||||
setId(rhs.getId());
|
||||
// Note: a = b, so there are two objects with the same hdf5 id
|
||||
// that's why incRefCount is needed, and it is called by setId
|
||||
}
|
||||
catch (Exception close_error) {
|
||||
throw FileIException(inMemFunc("operator="), close_error.getDetailMsg());
|
||||
}
|
||||
|
||||
// copy the data members from the rhs object
|
||||
p_setId(rhs.getId());
|
||||
incRefCount(getId()); // a = b, so there are two objects with the same
|
||||
// hdf5 id
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -190,9 +235,8 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs )
|
||||
///\exception H5::IdComponentException when the attempt to close the HDF5
|
||||
/// object fails
|
||||
// Description:
|
||||
// The underlaying reference counting in the C library ensures
|
||||
// that the current valid id of this object is properly closed.
|
||||
// Then the object's id is reset to the new id.
|
||||
// p_setId ensures that the current valid id of this object is
|
||||
// properly closed before resetting the object's id to the new id.
|
||||
// Programmer Binh-Minh Ribler - 2000
|
||||
// Modification
|
||||
// 2008/7/23 - BMR
|
||||
@@ -267,7 +311,7 @@ IdComponent::IdComponent() {}
|
||||
// Description:
|
||||
// This function is protected so that the user applications can
|
||||
// only have access to its code via allowable classes, namely,
|
||||
// H5File and H5Object subclasses.
|
||||
// Attribute and H5Location subclasses.
|
||||
// Programmer Binh-Minh Ribler - Jul, 2004
|
||||
//--------------------------------------------------------------------------
|
||||
H5std_string IdComponent::p_get_file_name() const
|
||||
@@ -285,11 +329,14 @@ H5std_string IdComponent::p_get_file_name() const
|
||||
|
||||
// Call H5Fget_name again to get the actual file name
|
||||
char* name_C = new char[name_size+1]; // temporary C-string for C API
|
||||
HDmemset(name_C, 0, name_size+1); // clear buffer
|
||||
|
||||
name_size = H5Fget_name(temp_id, name_C, name_size+1);
|
||||
|
||||
// Check for failure again
|
||||
if( name_size < 0 )
|
||||
{
|
||||
delete []name_C;
|
||||
throw IdComponentException("", "H5Fget_name failed");
|
||||
}
|
||||
|
||||
@@ -312,6 +359,9 @@ H5std_string IdComponent::p_get_file_name() const
|
||||
//--------------------------------------------------------------------------
|
||||
bool IdComponent::p_valid_id(const hid_t obj_id)
|
||||
{
|
||||
if (obj_id <= 0)
|
||||
return false;
|
||||
|
||||
H5I_type_t id_type = H5Iget_type(obj_id);
|
||||
if (id_type <= H5I_BADID || id_type >= H5I_NTYPES)
|
||||
return false;
|
||||
@@ -319,6 +369,14 @@ bool IdComponent::p_valid_id(const hid_t obj_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Notes about IdComponent::id
|
||||
// May 2008 - BMR
|
||||
// Class hierarchy is revised to address bugzilla 1068...
|
||||
// ...member IdComponent::id is moved into subclasses, and
|
||||
// IdComponent::getId now becomes pure virtual function.
|
||||
// (reasons: 1. encountered problems when adding H5Location;
|
||||
// 2. Scott Meyers, item 33)
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
|
||||
@@ -14,16 +14,21 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _IdComponent_H
|
||||
#define _IdComponent_H
|
||||
|
||||
// IdComponent represents an HDF5 object that has an identifier.
|
||||
#ifndef __IdComponent_H
|
||||
#define __IdComponent_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
class DataSpace;
|
||||
/*! \class IdComponent
|
||||
\brief Class IdComponent provides wrappers of the C functions that
|
||||
operate on an HDF5 identifier.
|
||||
|
||||
In most cases, the C library handles these operations and an application
|
||||
rarely needs them.
|
||||
*/
|
||||
class H5_DLLCPP IdComponent {
|
||||
public:
|
||||
// Increment reference counter.
|
||||
@@ -41,20 +46,32 @@ class H5_DLLCPP IdComponent {
|
||||
// Returns an HDF5 object type, given the object id.
|
||||
static H5I_type_t getHDFObjType(const hid_t obj_id);
|
||||
|
||||
// Returns an HDF5 object type of this object.
|
||||
H5I_type_t getHDFObjType() const;
|
||||
|
||||
// Assignment operator.
|
||||
IdComponent& operator=( const IdComponent& rhs );
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Gets the identifier of this object.
|
||||
virtual hid_t getId () const = 0;
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
// Sets the identifier of this object to a new value.
|
||||
void setId(const hid_t new_id);
|
||||
|
||||
// *** Deprecation warning ***
|
||||
// The following two constructors are no longer appropriate after the
|
||||
// data member "id" had been moved to the sub-classes.
|
||||
// The copy constructor is a noop and is removed in 1.8.15 and the
|
||||
// other will be removed from 1.10 release, and then from 1.8 if its
|
||||
// removal does not raise any problems in two 1.10 releases.
|
||||
|
||||
// Creates an object to hold an HDF5 identifier.
|
||||
IdComponent( const hid_t h5_id );
|
||||
|
||||
// Copy constructor: makes copy of the original IdComponent object.
|
||||
IdComponent( const IdComponent& original );
|
||||
// IdComponent( const IdComponent& original );
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Pure virtual function for there are various H5*close for the
|
||||
@@ -65,7 +82,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
|
||||
@@ -74,11 +91,10 @@ class H5_DLLCPP IdComponent {
|
||||
virtual ~IdComponent();
|
||||
|
||||
protected:
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
// Default constructor.
|
||||
IdComponent();
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
// Gets the name of the file, in which an HDF5 object belongs.
|
||||
H5std_string p_get_file_name() const;
|
||||
|
||||
@@ -88,6 +104,7 @@ class H5_DLLCPP IdComponent {
|
||||
// Sets the identifier of this object to a new value. - this one
|
||||
// doesn't increment reference count
|
||||
virtual void p_setId(const hid_t new_id) = 0;
|
||||
//virtual void p_setId(const hid_t new_id);
|
||||
|
||||
#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
@@ -96,4 +113,4 @@ class H5_DLLCPP IdComponent {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __IdComponent_H
|
||||
|
||||
@@ -28,3 +28,15 @@ typedef int bool;
|
||||
const bool false = 0;
|
||||
const bool true = 1;
|
||||
#endif
|
||||
|
||||
// These are defined in H5Opkg.h, which should not be included in the C++ API,
|
||||
// so re-define them here for now.
|
||||
|
||||
/* Initial version of the object header format */
|
||||
#define H5O_VERSION_1 1
|
||||
|
||||
/* Revised version - leaves out reserved bytes and alignment padding, and adds
|
||||
* magic number as prefix and checksum as suffix for all chunks.
|
||||
*/
|
||||
#define H5O_VERSION_2 2
|
||||
|
||||
|
||||
@@ -14,16 +14,17 @@
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef _H5IntType_H
|
||||
#define _H5IntType_H
|
||||
#ifndef __H5IntType_H
|
||||
#define __H5IntType_H
|
||||
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
namespace H5 {
|
||||
#endif
|
||||
|
||||
//! Class IntType operates on HDF5 integer datatype.
|
||||
class H5_DLLCPP IntType : public AtomType {
|
||||
public:
|
||||
// Creates a integer type using a predefined type
|
||||
// Creates an integer type using a predefined type
|
||||
IntType(const PredType& pred_type);
|
||||
|
||||
// Gets the integer datatype of the specified dataset
|
||||
@@ -35,7 +36,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
|
||||
@@ -53,4 +54,4 @@ class H5_DLLCPP IntType : public AtomType {
|
||||
#ifndef H5_NO_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // __H5IntType_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user