[svn-r23030] Tag as the v1.8.10 release.

This commit is contained in:
Albert Cheng
2012-11-14 10:23:33 -05:00
parent 545c05fee3
commit bee2bb49b8
2488 changed files with 1878159 additions and 0 deletions

20
hdf5_1_8_10/.autom4te.cfg Normal file
View File

@@ -0,0 +1,20 @@
# 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.
## ------------------ ##
## User Preferences. ##
## ------------------ ##
begin-language: "Autoconf"
args: --no-cache
end-language: "Autoconf"

View File

@@ -0,0 +1,56 @@
# 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.
# Initialization files for the Copyright Checker, chkcopyright.
# Each line is a keyword for action and the rest are values.
# Keywords:
# '#' Comments
# skip Files to be skipped
# prune Directories to be skipped. Notice this prunes all directories
# with the same name. E.g.,
# "prune test" skips test, fortran/test, c++/test, ...
# Skip COPYING since it is the detail Copyright notice.
skip COPYING
# Sort of strange to have a copyright notice in README
skip README
# Non-UI copyrighted files in top-level
skip aclocal.m4
# Non-UI copyrighted files in bin.
skip config.guess
skip config.sub
skip depcomp
skip install-sh
skip ltmain.sh
skip missing
skip mkinstalldirs
# Generated files in top-level
skip configure
# Generated files in src.
skip H5config.h.in
# Generated files in fortran/src.
skip H5match_types.c
skip H5test_kind.f90
# Ignore this expected output file in windows/examples.
skip testExamples_exp_output.txt
# Skip all testfiles/* since if we insert a copyright notice in the expected
# data files, we would have to spend extra effort to filter them out.
prune testfiles

View 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.

1156
hdf5_1_8_10/CMakeLists.txt Normal file

File diff suppressed because it is too large Load Diff

92
hdf5_1_8_10/COPYING Normal file
View File

@@ -0,0 +1,92 @@
Copyright Notice and License Terms for
HDF5 (Hierarchical Data Format 5) Software Library and Utilities
-----------------------------------------------------------------------------
HDF5 (Hierarchical Data Format 5) Software Library and Utilities
Copyright 2006-2012 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.
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:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions, and the following disclaimer in the documentation
and/or materials provided with the distribution.
3. In addition, redistributions of modified forms of the source or binary
code must carry prominent notices stating that the original code was
changed and the date of the change.
4. All publications or advertising materials mentioning features or use of
this software are asked, but not required, to acknowledge that it was
developed by The HDF Group and by the National Center for Supercomputing
Applications at the University of Illinois at Urbana-Champaign and
credit the contributors.
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 HDF Group, the University, or the Contributor, respectively.
DISCLAIMER:
THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS
"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no
event shall The HDF Group or the Contributors be liable for any damages
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
be retained in any redistribution of source code, binaries, documentation,
and/or accompanying materials:
This work was partially produced at the University of California,
Lawrence Livermore National Laboratory (UC LLNL) under contract
no. W-7405-ENG-48 (Contract 48) between the U.S. Department of Energy
(DOE) and The Regents of the University of California (University)
for the operation of UC LLNL.
DISCLAIMER:
This work was prepared as an account of work sponsored by an agency of
the United States Government. Neither the United States Government nor
the University of California nor any of their employees, makes any
warranty, express or implied, or assumes any liability or responsibility
for the accuracy, completeness, or usefulness of any information,
apparatus, product, or process disclosed, or represents that its use
would not infringe privately- owned rights. Reference herein to any
specific commercial products, process, or service by trade name,
trademark, manufacturer, or otherwise, does not necessarily constitute
or imply its endorsement, recommendation, or favoring by the United
States Government or the University of California. The views and
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.
-----------------------------------------------------------------------------

View File

@@ -0,0 +1,30 @@
## 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 "nei.hdfgroup.uiuc.edu")
SET (CTEST_DROP_LOCATION "/cdash/submit.php?project=HDF5.1.8")
ELSE (CDASH_LOCAL)
SET (CTEST_DROP_SITE "cdash.hdfgroup.uiuc.edu")
SET (CTEST_DROP_LOCATION "/submit.php?project=HDF518")
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_TEST_TIMEOUT 3600 CACHE STRING
"Maximum time allowed before CTest will kill the test.")
SET (DART_TESTING_TIMEOUT 3600 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.")

2666
hdf5_1_8_10/MANIFEST Normal file

File diff suppressed because it is too large Load Diff

204
hdf5_1_8_10/Makefile.am Normal file
View File

@@ -0,0 +1,204 @@
#
# 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.
##
## Makefile.am
## Run automake to generate a Makefile.in from this file.
##
#
# This makefile mostly just reinvokes make in the various subdirectories
# but does so in the correct order. You can alternatively invoke make from
# each subdirectory manually.
#
# Top-level HDF5 Makefile(.in)
# pmake has issues if variables are undefined. Solve this problem in
# top-level Makefile by defining .MAKEFLAGS target to -V before pmake can
# encounter any undefined variables.
# Automake resists putting anything but variable definitions first in
# a Makefile.in, so we'll put a placebo comment here and use sed in
# bin/reconfigure to turn it into the .MAKEFLAGS target. Sigh. -JL 2005
# Configure should set AM_MAKEFLAGS to -V to solve this problem in
# subdirectories.
# NOTE: This means that invoking pmake in a subdirectory will not work.
#xxx.MAKEFLAGS:@AM_MAKEFLAGS@
#xxx $(MAKE) all
#xxx
include $(top_srcdir)/config/commence.am
# Define subdirectories to build.
## Automake understands that `make distclean' should recurse into
## conditional subdirectories even if `make all' does not.
## We need to list the examples directory in the DIST_SUBDIRS variable
## so that it will be visited by `make distclean'
# Add this directory to SUBDIRS so that examples get built after tools
# but before examples in extra interfaces (c++ and fortran).
# Since we're explicitly listing DIST_SUBDIRS, we also need to list
# directories that are only conditionally built (so that their Makefiles
# are cleaned as well).
# Note that `make clean' will not affect the examples or doc directories.
# Conditionals. These conditionals are defined during configure
# Define each variable to empty if it is not used to placate pmake
if BUILD_PARALLEL_CONDITIONAL
TESTPARALLEL_DIR =testpar
else
TESTPARALLEL_DIR=
endif
if BUILD_CXX_CONDITIONAL
CXX_DIR =c++
else
CXX_DIR=
endif
if BUILD_FORTRAN_CONDITIONAL
FORTRAN_DIR =fortran
else
FORTRAN_DIR=
endif
if BUILD_HDF5_HL_CONDITIONAL
HDF5_HL_DIR =hl
else
HDF5_HL_DIR=
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
# 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 \
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
tests:
@@SETX@; for d in $(SUBDIRS) perform; 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
# Check-clean also recurses into examples directory
check-clean:
@@SETX@; for d in $(SUBDIRS) examples perform; 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.
mostlyclean-local:
if test -d ii_files; then \
$(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
uninstall-all:
@$(MAKE) $(AM_MAKEFLAGS) uninstall
# Install examples in this directory and recursively
install-examples uninstall-examples:
@@SETX@; for d in examples $(HDF5_INTERFACES) $(HL); do \
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
done
# Placeholder to remind users that docs are now in a separate repository.
install-doc:
@echo "docs no longer live in this tree. Use install-examples to install examples."
uninstall-doc:
@echo "docs no longer live in this tree. Use install-examples to install examples."
# `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:
@(cd src && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
# 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 \
if test $$d != .; then \
(cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
done
# Automake wants to make config.status depend on configure. This
# makes sense, but config.status can't always be regenerated
# properly, which can cause builds to fail.
# This is a problem for our Daily Tests, which need to be able to
# 'make distclean' reliably before running configure.
# The simple solution is to override the dependency Automake supplies
# for config.status so that it will never be regenerated.
$(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.

37
hdf5_1_8_10/Makefile.dist Normal file
View File

@@ -0,0 +1,37 @@
# Top-level distributed Makefile -*- makefile -*-
# 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 Makefile is a stub (copied from Makefile.dist) which will run
# configure and then invoke the same target in the new Makefile created
# by configure.
# Uncomment this variable if your make(1) doesn't set it automatically.
#
#MAKE=make
SHELL=/bin/sh
all lib progs check test _test install uninstall dep depend: _config
$(MAKE) $@
clean mostlyclean distclean maintainer-clean TAGS: _config
$(MAKE) $@
_config:
sh configure
.PHONY: all lib progs test install uninstall dep depend clean mostlyclean \
distclean maintainer-clean _config

1111
hdf5_1_8_10/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

41
hdf5_1_8_10/README.txt Normal file
View File

@@ -0,0 +1,41 @@
HDF5 version 1.8.10 released on 2012-10-26
Please refer to the release_docs/INSTALL file for installation instructions.
------------------------------------------------------------------------------
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 release can be found at the following URL:
http://www.hdfgroup.org/HDF5/doc/.
The following mailing lists are currently set up for HDF5 Library users:
news - For announcements of HDF5 related developments,
not a discussion list.
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@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@hdfgroup.org
Messages sent to the list should be addressed to "<list>@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.
The HDF5 website is located at http://hdfgroup.org/HDF5/
Bugs should be reported to help@hdfgroup.org.

9629
hdf5_1_8_10/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

139
hdf5_1_8_10/acsite.m4 Normal file
View File

@@ -0,0 +1,139 @@
dnl -------------------------------------------------------------------------
dnl -------------------------------------------------------------------------
dnl
dnl Copyright by the Board of Trustees of the University of Illinois.
dnl All rights reserved.
dnl
dnl This file is part of HDF5. The full HDF5 copyright notice, including
dnl terms governing use, modification, and redistribution, is contained in
dnl the files COPYING and Copyright.html. COPYING can be found at the root
dnl of the source code distribution tree; Copyright.html can be found at the
dnl root level of an installed copy of the electronic HDF5 document set and
dnl is linked from the top-level documents page. It can also be found at
dnl http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have
dnl access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
dnl
dnl Macros for HDF5 Fortran
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
dnl Check how F9X handles modules. This macro also checks which
dnl command-line option to use to include the module once it's built.
dnl
AC_DEFUN(AC_F9X_MODS,
[AC_MSG_CHECKING(what $FC does with modules)
AC_LANG_PUSH(Fortran)
test -d conftestdir || mkdir conftestdir
cd conftestdir
rm -rf *
cat >conftest.$ac_ext <<EOF
module module
integer foo
end module module
EOF
eval $ac_compile
modfiles=""
F9XMODEXT=""
for f in conftest.o module.mod MODULE.mod module.M MODULE.M; do
if test -f "$f" ; then
modfiles="$f"
case "$f" in
*.o) F9XMODEXT="o" ;;
*.mod) F9XMODEXT="mod" ;;
*.M) F9XMODEXT="M" ;;
esac
fi
done
echo $modfiles 6>&1
if test "$modfiles" = file.o; then
echo $ac_n "checking whether $FC -em is saner""... $ac_c" 1>&6
OLD_FCFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS -em"
eval $ac_compile
modfiles=""
for f in file.o module.mod MODULE.mod module.M MODULE.M; do
test -f $f && modfiles="$f"
done
if test "$modfiles" = "file.o"; then
FCFLAGS=$OLD_FCFLAGS
echo no 6>&1
else
echo yes 6>&1
fi
fi
cd ..
AC_MSG_CHECKING(how $FC finds modules)
for flag in "-I" "-M" "-p"; do
cat >conftest.$ac_ext <<EOF
program conftest
use module
end program conftest
EOF
ac_compile='${FC-f90} $FCFLAGS ${flag}conftestdir -c conftest.$ac_ext 1>&AS_MESSAGE_LOG_FD'
if AC_TRY_EVAL(ac_compile); then
F9XMODFLAG=$flag
break
fi
done
if test -n "$F9XMODFLAG"; then
echo $F9XMODFLAG 1>&6
FCFLAGS="$F9XMODFLAG. $FCFLAGS"
else
echo unknown 1>&6
fi
AC_SUBST(F9XMODFLAG)
AC_SUBST(F9XMODEXT)
rm -rf conftest*
AC_LANG_POP(Fortran)
])

16
hdf5_1_8_10/bin/COPYING Executable file
View File

@@ -0,0 +1,16 @@
Copyright by The HDF Group and
The Board of Trustees of the University of Illinois.
All rights reserved.
The files and subdirectories in this directory are 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://www.hdfgroup.org/HDF5/doc/Copyright.html. If you do not
have access to either file, you may request a copy from
help@hdfgroup.org.

324
hdf5_1_8_10/bin/buildhdf5 Executable file
View File

@@ -0,0 +1,324 @@
#!/bin/sh
#
# 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.
#
# Build HDF5 library by doing configure, make, and tests.
# Usage: See USAGE()
# Programmer: Albert Cheng
# Creation date: Jul 9, 2003
# Some handy definitions
USAGE()
{
cat <<EOF
Buildhdf5 builds the HDF5 library by running configure, make and make check.
It skips the configure part if one has been done already. In effect, one
can continue from a previous build.
Command Syntax
==============
buildhdf5 [-config] [-szlib] [-help] [-n] [-srcdir dir] [-fortran] [-cxx] [-pp] config-arguments ...
-config: run configure only. [default to do build too]
-szlib: configure in the szlib option
-help: show this help page
-n: no execution, just show commands
-srcdir: use dir as the source directory
[Note: this is different from --srcdir
which will be passed to configure]
-fortran: add --enable-fortran
-cxx: add --enable-cxx
-pp: add --enable-parallel
all other arguments are passed to configure
Configure in place or by srcdir
===============================
By default, the command looks for the configure command in
'.' and then '../hdf5'. When it finds it, it uses it to do
the configure part. In effect, if ./configure is found, it
does the build in place. If it finds ../hdf5/configure, it
does the --srcdir (that is separated source) build. Therefore,
if you have the following structure setup, you can run multiple
hosts building simultantously using a common source code.
hdf5_v1.7/hdf5 # holds the source
.../sunbox # for SunOS
.../linux # for Linux
.../linuxpp # for Linux parallel
EOF
}
TIMESTAMP()
{
echo "=====" "`date`" "====="
}
QUIT()
{
# print the closing time
TIMESTAMP
}
# 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.
STEP()
{
banner="$1"
command="$2"
resultfile="$3"
echo "$banner"
(TIMESTAMP; nerror=0 ;
echo "eval $command"
eval $command || nerror=1 ;
TIMESTAMP; exit $nerror) < /dev/null >> "$resultfile" 2>&1
if [ $? -ne 0 ]; then
echo "error in '$banner'. buildhdf5 aborted."
exit 1
fi
}
# Try locate the SZLIB.
# This is a hack because there is no consistent szlib pathname.
LOCATE_SZLIB()
{
# Try to guess what domain I am in.
if [ -d /usr/hdf/bin ]; then
# I am in an THG host.
mydomain=thg
elif [ -d /afs/ncsa/projects/hdf/packages ]; then
# I am in an NCSA host that has AFS.
mydomain=ncsa
else
mydomain=unknown
fi
case $mydomain in
thg)
# THG hosts
OS=`uname -s`
echo OS=$OS
case "$OS" in
Linux)
case `uname -m` in
i686) # 32 bits
szlibpaths="/home/packages/szip/static/encoder/Linux2.6-gcc"
;;
x86_64) # 64 bits
szlibpaths="/home/packages/szip/static/encoder/Linux2.6-x86_64-gcc"
;;
*)
# Don't know. Give a shot at standard places.
szlibpaths="/usr/hdf /usr/local"
;;
esac
;;
SunOS)
szlibpaths="/home/packages/szip/static/encoder/SunOS-5.10"
;;
FreeBSD)
case `uname -m` in
i386) # 32 bits
szlibpaths="/home/packages/szip/static/encoder/FreeBSD"
;;
amd64) # 64 bits
szlibpaths="/home/packages/szip/static/encoder/FreeBSD-64"
;;
*)
# Don't know. Give a shot at standard places.
szlibpaths="/usr/hdf /usr/local"
;;
esac
;;
*)
# Don't know. Give a shot at standard places.
szlibpaths="/usr/hdf /usr/local"
;;
esac
;; # end of case thg
ncsa)
# ncsa hosts
OS=`uname -s`
echo OS=$OS
case "$OS" in
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)
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/Linux2.4"
;;
*)
# Don't know. Give a shot at standard places.
szlibpaths="/usr/ncsa /usr/sdt"
;;
esac
;;
SunOS)
szlibpaths="/afs/ncsa/projects/hdf/packages/szip_new/SunOS_5.8"
;;
*)
# Don't know. Give a shot at standard places.
szlibpaths="/usr/ncsa /usr/sdt"
;;
esac
;; # end of case ncsa
unknown)
# Unknow domain. Give a shot at the some standard places.
szlibpaths="/usr/local"
;;
esac # end of case $mydomain
echo szlibpaths=$szlibpaths
for x in $szlibpaths dummy; do
if [ $x != dummy -a -f $x/include/szlib.h -a -f $x/lib/libsz.a ]; then
WITH_SZLIB="--with-szlib=$x"
break
fi
done
echo WITH_SZLIB="$WITH_SZLIB"
}
# Configure. Default to do --srcdir.
CONFIG()
{
CMD="$SRCDIR/configure $*"
echo $CMD
if [ "$NOEXEC" != 'noexec' ]; then
$CMD
else
true # set exit code as 0
fi
}
# Main body
TIMESTAMP
trap QUIT 0
#
# setup
#
MAKE=${MAKE:-'gmake'}
export MAKE
CONFIG_CMD="CONFIG"
CONFIG_OP= # configure options
CONFIG_ONLY=no # default is configure and build
NOEXEC= # default to execute commands
SRCDIRLIST=". ../hdf5" # places to look for configure
nerror=0
# parse some options
while [ $# -gt 0 ]; do
case "$1" in
-config)
# do configure only
CONFIG_ONLY=yes
;;
-szlib)
LOCATE_SZLIB
CONFIG_OP="$CONFIG_OP $WITH_SZLIB"
;;
-help)
USAGE
exit 0
;;
-n)
NOEXEC='noexec'
;;
-srcdir)
shift
SRCDIRLIST="$1"
;;
-cxx)
CONFIG_OP="$CONFIG_OP --enable-cxx"
;;
-fortran)
CONFIG_OP="$CONFIG_OP --enable-fortran"
;;
-pp)
CONFIG_OP="$CONFIG_OP --enable-parallel"
;;
*) # pass it as a configure option
CONFIG_OP="$CONFIG_OP $1"
;;
esac
shift
done
# Figure out if srcdir is wished.
# Make sure we are at the library root level
# by checking couple typical files. Not bullet-proof.
for SRCDIR in $SRCDIRLIST dummy; do
if [ x-$SRCDIR = x-dummy ]; then
break
fi
if [ -d $SRCDIR/src -a -d $SRCDIR/config -a -f $SRCDIR/configure ]
then
break
fi
done
if [ x-$SRCDIR = x-dummy ]; then
echo "Could not find the source dir or configure script. Abort."
exit 1
fi
# Configure
# no configure if already done.
if [ ! -f config.status ]; then
STEP "Configure HDF5..." "$CONFIG_CMD $CONFIG_OP" "#config"
else
STEP "Configure Skipped" "echo Configure Skipped" "#config"
fi
if [ x-$CONFIG_ONLY = x-yes ]; then
exit 0
fi
# Compile
STEP "Make HDF5..." "$MAKE" "#make"
# Serial tests
STEP "Testing HDF5 serial parts..." "$MAKE check-s" "#test-s"
# Parallel tests
STEP "Testing HDF5 parallel parts..." "$MAKE check-p" "#test-p"
# all done
echo "No Errors encountered"

49
hdf5_1_8_10/bin/checkapi Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/perl -w
#
# 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.
#
require 5.003;
# Purpose: insures that API functions aren't called internally.
# Usage: checkapi H5*.c
my $comment = 0;
while (<>) {
# Remove comments within the line.
s/\/\*.*?\*\///g;
# 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
# 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)*/;
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
}
}

86
hdf5_1_8_10/bin/checkposix Executable file
View File

@@ -0,0 +1,86 @@
#!/usr/local/bin/perl -w
require 5.003;
#
# 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.
#
# Robb Matzke, matzke@llnl.gov
# 30 Aug 1997
#
# Purpose: Given the names of C source files this script will print the
# file name, line number, and function name of any function that
# doesn't begin with the letter `h' or `H' as stipulated by the
# HDF5 programming style guide.
#
# Emacs users can run this script as the compile command and
# use `next-error' (usually bound to M-`) to find each name
# violation.
while (<>) {
# 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 string constants if they begin and end on this line.
s/([\'\"])([^\1]|\\\1)*?\1/$1$1/g;
# Get rid of preprocessor directives
s/^\#.*//;
# 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)$/;
# Ignore things that get misdetected because of the simplified
# parsing that takes place here.
next if $name =~ /^int$/;
# 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$/;
# These functions/macros are exempt.
next if $name =~ /^(assert|main|[fs]?printf|va_(start|arg|end))$/;
# These are MPI function calls. Ignore them.
next if $name =~ /^MPI_/;
# These are POSIX threads function calls. Ignore them.
next if $name =~ /^pthread_/;
print "$ARGV:$.: $name\n";
}
} continue {
close ARGV if eof;
}

84
hdf5_1_8_10/bin/chkconfigure Executable file
View File

@@ -0,0 +1,84 @@
#!/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.
##
# Check that all the configure files are properly genernated.
#
# Programmer: Albert Cheng
# Created Date: 2004/12/07
#
# Configure: should be generated by autoconf version 2.69.
# autoconf: should be of version 2.69.
# variable initialization
nerrors=0
AUTOCONFVERSION=2.69
AUTOCONFVERSIONLEAD='Generated by GNU Autoconf'
CONFIGUREFILES="configure"
# Function definitions
#
# PRINTMSG
# Print a one line message left justified in a field of 70 characters
# without newline. More output for this line later.
#
PRINTMSG() {
SPACES=" "
echo "$* $SPACES" | cut -c1-70 | tr -d '\012'
}
# print result passed.
PASSED() {
echo " PASSED"
}
# print result failed.
FAILED() {
echo "*FAILED*"
}
# Main body
# Check configure files
# The autoconf version should be among the first 5 lines.
echo "Check autoconf version. Should be version $AUTOCONFVERSION"
for xf in $CONFIGUREFILES; do
PRINTMSG $xf
if [ ! -f $xf ]; then
FAILED
echo File not found
nerrors=`expr $nerrors + 1`
continue
fi
autoconf_version=`head -5 $xf | grep "$AUTOCONFVERSIONLEAD"`
echo $autoconf_version | grep "$AUTOCONFVERSIONLEAD $AUTOCONFVERSION" > /dev/null 2>&1
if [ $? -eq 0 ]; then
PASSED
else
FAILED
echo "Expected: $AUTOCONFVERSIONLEAD $AUTOCONFVERSION"
echo "Got: $autoconf_version"
nerrors=`expr $nerrors + 1`
fi
done
# Summary
echo $0 found $nerrors errors
if [ $nerrors != 0 ]; then
exit 1
fi
exit 0

911
hdf5_1_8_10/bin/chkcopyright Executable file
View File

@@ -0,0 +1,911 @@
#! /bin/sh
#
# 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.
#
# Check Copyright notice.
# Check that all the files have the proper copyright notice.
# It goes down directories recursively.
#
# Programmer: Albert Cheng
# Created Data: 2003/07/22
# Modification:
# Rewrote most of it. Albert Cheng, 2005/10/10.
# Setup
#
PROGNAME=$0
DIFF="diff"
INITFILE=.h5chkright.ini
EXCEPTIONS=/tmp/h5chkright.except.$$
tmpfile=/tmp/h5chkright_tmp.$$
EXCEPTIONDIRS="-name CVS -o -name .svn" # at least skip CVS directories.
EXTRACTEDFILE=/tmp/h5chkright.extracted.$$
VERBOSE= # default no
FIXIT= # default no
DIRS=. # default current directory
NFAILEDFILES=0 # Number of failed files found.
NPASSEDFILES=0 # Number of passed files found.
NFIXEDFILES=0 # Number of files fixed.
NFIXFAILEDFILES=0 # Number of files fix failed.
NUMBEGINLINES=60 # Copyright notice should be located within the
# this number of lines at the beginning of the file.
UICOPYRIGHTSTR="Copyright by the Board of Trustees of the University of Illinois"
THGCOPYRIGHTSTR="Copyright by The HDF Group."
PASSEDLOG=/tmp/h5chkright_passed.$$
SKIPPEDLOG=/tmp/h5chkright_skipped.$$
FAILEDLOG=/tmp/h5chkright_failed.$$
FIXEDLOG=/tmp/h5chkright_fixed.$$
FIXFAILEDLOG=/tmp/h5chkright_fixfailed.$$
C_COPYRIGHT=/tmp/h5chkright_C.$$ # C style copyright
FTN_COPYRIGHT=/tmp/h5chkright_FTN.$$ # Fortran style copyright
HTM_COPYRIGHT=/tmp/h5chkright_HTM.$$ # HTML style copyright
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_AC_COPYRIGHT=/tmp/h5chkright_CONFIGURE_AC.$$ # configure.ac file Copyright notice
tmpfixfile=/tmp/h5chkright_fix.$$ # Temporary fixed copy of file
# Caution message of the fix feature.
FIXCAUTIONMSG()
{
cat <<EOF
**CAUTION**
The fix is a best attempt. Check the changes before committing them.
EOF
}
# Help page
#
USAGE()
{
cat <<EOF
Usage: $PROGNAME [-h | -help] [-fname name-patter] [-v | -v9] [dir1 dir2 ...]
Check copyright notices of files in [dir1 dir2 ...}.
Default is to check files in current directory.
-h | -help
show this page.
-fname name-pattern
limit to files of name-pattern
-v
verbose mode
-v9
highly verbose
-fix
fix failed files if possible.
EOF
FIXCAUTIONMSG
}
# Print Debug output
#
PRINTDEBUG()
{
if [ -n "$VERBOSE" ]; then
echo $*
else
: # noop
fi
}
# Generate various styles of Copyright notices
#
BUILDCOPYRIGHT()
{
# C and C++ source Copyright notice
cat > ${C_COPYRIGHT} << \EOF
* 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. *
EOF
# Fortran9X source Copyright notice
cat > ${FTN_COPYRIGHT} << \EOF
! 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. *
EOF
# HTML file Copyright notice
cat > ${HTM_COPYRIGHT} << \EOF
* 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. *
EOF
# Shell style Copyright notice
cat > ${SH_COPYRIGHT} << \EOF
# 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.
EOF
# Shell style Copyright notice (2nd type)
cat > ${SH_COPYRIGHT2} << \EOF
## 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.
EOF
# Windows Batch file Copyright notice
cat > ${WINBAT_COPYRIGHT} << \EOF
@REM Copyright by The HDF Group.
@REM Copyright by the Board of Trustees of the University of Illinois.
@REM All rights reserved.
@REM
@REM This file is part of HDF5. The full HDF5 copyright notice, including
@REM terms governing use, modification, and redistribution, is contained in
@REM the files COPYING and Copyright.html. COPYING can be found at the root
@REM of the source code distribution tree; Copyright.html can be found at the
@REM root level of an installed copy of the electronic HDF5 document set and
@REM is linked from the top-level documents page. It can also be found at
@REM http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
@REM access to either file, you may request a copy from help@hdfgroup.org.
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.
dnl
dnl This file is part of HDF5. The full HDF5 copyright notice, including
dnl terms governing use, modification, and redistribution, is contained in
dnl the files COPYING and Copyright.html. COPYING can be found at the root
dnl of the source code distribution tree; Copyright.html can be found at the
dnl root level of an installed copy of the electronic HDF5 document set and
dnl is linked from the top-level documents page. It can also be found at
dnl http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
dnl access to either file, you may request a copy from help@hdfgroup.org.
EOF
# VMS command file Copyright notice
cat > ${VMSCMD_COPYRIGHT} << \EOF
$!# 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.
EOF
}
# Initialization
#
# Initialize file format:
# Each line is a keyword for action and the rest are values.
# Keywords:
# '#' Comments
# skip Files to be skipped
# prune Directories to be skipped. Notice this prunes all directories
# with the same name. E.g.,
# "prune test" skips test, fortran/test, c++/test, ...
# (See -name option in the find command.)
# prunepath Directory or file to be skipped. Notice this is different from
# prunes since it matches the exact pathname. E.g.,
# "prunepath ./tools/testfiles" skips the directory/file matching
# exactly that path but NOT tools/h5dump/testfiles nor
# tools/h5dump/testfiles.
# (See -path option in the find command.)
#
INITIALIZATION()
{
# clean up log files
rm -f $PASSEDLOG $SKIPPEDLOG $FAILEDLOG $FIXEDLOG $FIXFAILEDLOG
# Generate various styles of copyright notice.
BUILDCOPYRIGHT
echo Initialization...
# setup exceptions.
cp /dev/null $EXCEPTIONS
# Process Initial setting file if exists
if [ -r $INITFILE ]; then
while read key value; do
case "$key" in
\#* | '') # Comment or blank line, skip it
continue
;;
skip)
echo $key $value
echo $value >> $EXCEPTIONS
;;
prune)
echo $key $value
EXCEPTIONDIRS="$EXCEPTIONDIRS -o -name $value"
;;
prunepath)
echo $key $value
EXCEPTIONDIRS="$EXCEPTIONDIRS -o -path $value"
;;
*)
echo unknown setting input in file $INITFILE
echo $key $value
;;
esac
done < $INITFILE
fi
# Change EXCEPTIONDIRS to be compatible with find command.
EXCEPTIONDIRS="( $EXCEPTIONDIRS ) -prune -o"
echo Initialization done
}
# Parse Options
#
PARSE_OPTION()
{
while test $# -gt 0 ; do
case "$1" in
-h | -help )
USAGE
exit 0
;;
-fname )
shift
FNAME="$1"
;;
-fix )
FIXIT=yes
;;
-v* )
VERBOSE=yes
if test X$1 = X-v9; then
set -x
fi
;;
-* )
echo "***Unknown option ($1)"
USAGE
exit 1
;;
* )
DIRS=$*
break
;;
esac
shift
done
}
# Rinse the file by,
# removing all \r which is often present in Windows files;
# replace tabs with equivalent spaces;
# removing all trailing spaces.
# $1 is the file to be rinsed.
RINSE()
{
rf=$1
cp $rf $tmpfile
dos2unix < $tmpfile | expand | sed -e 's/ *$//' > $rf
}
# Locate a line in the file and print the line number.
# Print 0 if not found; -1 if error.
# $1 The line.
# $2 The file.
#
FindLineInFile()
{
if [ $# -ne 2 ]; then
# expect two arguments
echo -1
return
fi
xline=$1
xf=$2
xpos=`grep -n "${xline}" $xf`
if [ "$?" -ne 0 ] ; then
# Not found, return 0
xpos=0
else
xpos=`echo $xpos | cut -f1 -d:`
fi
echo $xpos
}
# Match Copyright notice.
# $1 file which contains the expected copyright notice.
# $2 file in which to look for the copyright notice.
# Copyright notice must be found within the beginning $NUMBEGINLINES of lines.
# Hunt for the particular string $UICOPYRIGHTSTR which signifies the beginning
# of the copyright notice.
#
MATCH_COPYRIGHT()
{
if [ $# -ne 2 ]; then
# expect two arguments
echo FAILED
return
fi
COPYRIGHTFILE=$1
f=$2
nlines=`wc -l ${COPYRIGHTFILE} | cut -f1 -d' '`
# Find a line that contains the copyright string and its line number in
# the file.
begin=`FindLineInFile "${UICOPYRIGHTSTR}" $f`
if [ "$begin" -le 0 ] ; then
# Not found, generate an empty dummy file
cp /dev/null ${EXTRACTEDFILE}
false
else
if [ $begin -gt 1 ]; then
begin=`expr $begin - 1`
fi
end=`expr $begin + $nlines - 1`
sed -n -e "${begin},${end}p" < $f > ${EXTRACTEDFILE}
RINSE ${EXTRACTEDFILE}
$DIFF ${EXTRACTEDFILE} ${COPYRIGHTFILE} >/dev/null 2>&1
fi
if test $? -eq 0; then
echo PASSED
else
echo FAILED
fi
}
# Fix Copyright notice.
# $1 file which contains the expected copyright notice.
# $2 file in which to look for the copyright notice.
# Copyright notice must be found within the beginning $NUMBEGINLINES of lines.
# Hunt for the particular string $UICOPYRIGHTSTR which signifies the beginning
# of the copyright notice.
#
FIX_COPYRIGHT()
{
if [ $# -ne 2 ]; then
# expect two arguments
echo FAILED
return
fi
COPYRIGHTFILE=$1
f=$2
nlines=`wc -l ${COPYRIGHTFILE} | cut -f1 -d' '`
# If the file has UICOPYRIGHTSTR but not THGCOPYRIGHTSTR, then replace the lines
# starting at UICOPYRIGHTSTR and down.
# If the file has THGCOPYRIGHTSTR, then replace the lines starting at the
# THGCOPYRIGHTSTR and down.
# If neither found, abort it.
# Find a line that contains the THG copyright string and its line number in
# the file.
insertbegin=`FindLineInFile "${THGCOPYRIGHTSTR}" $f`
if [ $insertbegin -gt 0 ]; then
insertend=`expr $insertbegin + $nlines` # no need to -1. See below.
else
insertbegin=`FindLineInFile "${UICOPYRIGHTSTR}" $f`
if [ $insertbegin -gt 0 ]; then
insertend=`expr $insertbegin + $nlines - 1` # no need to -2. See below.
else
FIXFAILED
return
fi
fi
# Copy line 1 up to insertbegin from original file
xbegin=`expr $insertbegin - 1`
if [ $xbegin -gt 0 ]; then
sed -n -e "1,${xbegin}p" $f > $tmpfixfile
else
cp /dev/null $tmpfixfile # make it empty.
fi
# now the correct copyright file
cat $COPYRIGHTFILE >> $tmpfixfile
# the rest of the original file
sed -n -e "${insertend},"'$p' $f >> $tmpfixfile
# copy them all back to the original file
cp $tmpfixfile $f
FIXED
rm -f $tmpfixfile
}
# Check C and C++ source files
#
C_SOURCE()
{
f=$1
case `MATCH_COPYRIGHT $C_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${C_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $C_COPYRIGHT $f
fi
;;
esac
}
# Check Fortran90 source files
#
FORTRAN_SOURCE()
{
f=$1
case `MATCH_COPYRIGHT $FTN_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${FTN_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $FTN_COPYRIGHT $f
fi
;;
esac
}
# Check HTML Files
#
HTML_FILE()
{
f=$1
case `MATCH_COPYRIGHT $HTM_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${HTM_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $HTM_COPYRIGHT $f
fi
;;
esac
}
# Check Shell script files which use the style of copyright notice of leading #'s.
#
SHELL_FILE()
{
f=$1
case `MATCH_COPYRIGHT $SH_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${SH_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $SH_COPYRIGHT $f
fi
;;
esac
}
# Check files that use #'s as comments such as Makefile.
# The Copyright body of text happen to be the same as used by Shell script
# files.
#
MAKE_FILE()
{
f=$1
case `MATCH_COPYRIGHT $SH_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${SH_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $SH_COPYRIGHT $f
fi
;;
esac
}
# Check Windows Batch files
#
BATCH_FILE()
{
f=$1
case `MATCH_COPYRIGHT $WINBAT_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${WINBAT_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $WINBAT_COPYRIGHT $f
fi
;;
esac
}
# Check Windows Batch files
#
VMSCMD_FILE()
{
f=$1
case `MATCH_COPYRIGHT $VMSCMD_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${VMSCMD_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $VMSCMD_COPYRIGHT $f
fi
;;
esac
}
# Check Configure.in type files
#
CONFIGURE_AC_FILE()
{
f=$1
case `MATCH_COPYRIGHT $CONFIGURE_AC_COPYRIGHT $f` in
PASSED)
PASSED $f
return
;;
FAILED)
# show the difference
FAILED $f
$DIFF ${EXTRACTEDFILE} ${CONFIGURE_AC_COPYRIGHT}
if [ -n "$FIXIT" ]; then
FIX_COPYRIGHT $CONFIGURE_AC_COPYRIGHT $f
fi
;;
esac
}
# Guess the type of file.
# Inspect the first 5 lines to guess what type of file it is.
#
GUESS_File_Type()
{
if [ $# -ne 1 ]; then
echo "wrong number of arguments($#)"
return
fi
f=$1
# Now guess the file type.
head -5 < $f > $tmpfile
if head -1 < $tmpfile | grep '^#!' > /dev/null; then
# First line is "#!". It is likely a shell script or similar type.
echo SHELL_FILE
elif grep '\/\*' < $tmpfile > /dev/null; then
# Found some lines containing '/*'. It may be a C/C++ style file.
echo C_SOURCE
elif grep '^!' < $tmpfile > /dev/null; then
# Some lines start with a "!". It may be a Fortran 9X style file.
echo FORTRAN_SOURCE
elif grep '^#' < $tmpfile > /dev/null; then
# Some lines start with a "#". It may be a shell like 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.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.
# It may be an HTML file.
echo HTML_FILE
else
# Unknown type.
echo UNKNOWN_TYPE
fi
}
# Check Unknown type file.
# First check if there is something that resemble a copyright notice in
# the first "page". If so, then inspect the first 5 lines to guess what
# type of file it is. Then try verify Copyright notice according to
# guessed type.
#
UNKNOWN_FILE()
{
f=$1
if head -$NUMBEGINLINES < $f | grep "${COPYRIGHTSTR}" > /dev/null; then
xftype=`GUESS_File_Type $f`
PRINTDEBUG f=$f xftype=$xftype > /dev/tty
case $xftype in
SHELL_FILE) SHELL_FILE $f;;
C_SOURCE) C_SOURCE $f;;
FORTRAN_SOURCE) FORTRAN_SOURCE $f;;
SHELL_FILE) SHELL_FILE $f;;
HTML_FILE) HTML_FILE $f;;
UNKNOWN_TYPE) UNKNOWN_TYPE $f;;
esac
else
# Unknown type.
UNKNOWN_TYPE $f
fi
}
# Passed checking.
# $1 file that has passed.
#
PASSED()
{
if test X-$VERBOSE = X-yes; then
echo " PASSED"
fi
echo $1 >> $PASSEDLOG
}
# Unknown file type. Considered a fail.
# $1 name of unknown file.
#
UNKNOWN_TYPE()
{
echo "UNKNOWN type: $1" | tee -a $FAILEDLOG
}
# Skip checking.
# $1 file that is skipped.
#
SKIP()
{
if test X-$VERBOSE = X-yes; then
echo " SKIPPED"
fi
echo $1 >> $SKIPPEDLOG
}
# Failed checking.
# $1 file that has failed.
#
FAILED()
{
echo "FAILED: $1"
echo $1 >> $FAILEDLOG
}
# Copyright fixed.
# $1 file that has been fixed.
#
FIXED()
{
if test X-$VERBOSE = X-yes; then
echo " FIXED"
fi
echo $1 >> $FIXEDLOG
}
# Copyright fix failed.
# $1 file that has failed.
#
FIXFAILED()
{
echo "FIX FAILED: $1"
echo $1 >> $FIXFAILEDLOG
}
#
# Main body
PARSE_OPTION "$@"
INITIALIZATION
# use find to list all those file names and process them
# one by one.
if test -z "$FNAME" ; then
find $DIRS $EXCEPTIONDIRS -type f -print
else
find $DIRS -type f -name "${FNAME}" -print
fi |
while read file; do
if test X-$VERBOSE = X-yes; then
echo checking ${file}...
fi
if echo $file | egrep -f $EXCEPTIONS > /dev/null; then
SKIP ${file}
else
case ${file} in
*.c | *.h | *.cpp )
C_SOURCE ${file}
;;
*.f90 )
FORTRAN_SOURCE ${file}
;;
*.htm | *.html )
HTML_FILE ${file}
;;
*.sh | *.sh.in )
SHELL_FILE ${file}
;;
*.pl )
# Perl script files are similar to Shell files
SHELL_FILE ${file}
;;
*Makefile | *Makefile.in | *Makefile.am | Makefile.dist )
MAKE_FILE ${file}
;;
configure.ac )
CONFIGURE_AC_FILE ${file}
;;
*.bat | *.BAT )
# Windows Batch files
BATCH_FILE ${file}
;;
*.com )
# VMS Command files
VMSCMD_FILE ${file}
;;
*.h5 | *.hdf5 )
# Ignore HDF5 data files
continue
;;
*.jpg | *.obj | *.gif | *.png | *.pdf | \
*.JPG | *.OBJ | *.GIF | *.PNG | *.PDF )
# Ignore binary data files
continue
;;
*.zip | *.dsp | *.dsw | *.js | *.sln )
# Ignore Windows binary or special files.
# .dsp & .dsw are Visual Studio project files.
# .sln are .NET solution files.
# .js are Microsoft Java Script files.
continue
;;
*CVS/* )
# Ignore CVS control files.
continue
;;
*.txt | *.TXT )
# Ignore text files.
continue
;;
*)
UNKNOWN_FILE $file
;;
esac
fi
done
# check results
if [ -f $PASSEDLOG ]; then
NPASSEDFILES=`wc -l < $PASSEDLOG`
fi
if [ -f $FAILEDLOG ]; then
NFAILEDFILES=`wc -l < $FAILEDLOG`
fi
if [ -f $FIXEDLOG ]; then
NFIXEDFILES=`wc -l < $FIXEDLOG`
fi
if [ -f $FIXFAILEDLOG ]; then
NFIXFAILEDFILES=`wc -l < $FIXFAILEDLOG`
fi
# Cleanup
rm -f $C_COPYRIGHT $FTN_COPYRIGHT $HTM_COPYRIGHT $SH_COPYRIGHT $SH_COPYRIGHT2
rm -f $EXCEPTIONS $EXTRACTEDFILE
rm -f $PASSEDLOG $SKIPPEDLOG $FAILEDLOG $FIXEDLOG $FIXFAILEDLOG
# Report Results
# Results are not total accurate--e.g., Skipped are not counted, thus not
# reported.
#
echo "*******************"
echo " REPORT"
echo "*******************"
echo Number of passed files = $NPASSEDFILES
echo Number of failed files = $NFAILEDFILES
echo Number of fixed files = $NFIXEDFILES
echo Number of fix failed files = $NFIXFAILEDFILES
if [ $NFIXEDFILES -gt 0 ]; then
FIXCAUTIONMSG
fi
if [ $NFAILEDFILES -gt 0 ]; then
exitcode=1
else
exitcode=0
fi
exit $exitcode

179
hdf5_1_8_10/bin/chkmanifest Executable file
View File

@@ -0,0 +1,179 @@
#!/bin/sh
#
# 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.
#
# Check that all the files in MANIFEST exist and that (if this is a
# SVN checkout) that all the SVN-managed files appear in the
# MANIFEST.
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
# 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.
if [ -f MANIFEST ]; then
continue
elif [ -f ../MANIFEST ]; then
cd ..
else
commanddir=`dirname $0`
if [ -d "$commanddir" -a -f $commanddir/MANIFEST ]; then
cd $commanddir
continue
else
echo MANIFEST file not found. Abort.
exit 1
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
for file in `cat $MANIFEST`; do
if [ ! -f $file ]; then
echo "- $file"
fail=yes
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 "Unknown svn entries format. Aborted"
exit 1
fi
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
done
if [ "X$fail" = "Xyes" ]; then
cat 1>&2 <<EOF
The MANIFEST is out of date. Files marked with a minus sign (-) no
longer exist; files marked with a plus sign (+) are SVN-managed but do
not appear in the MANIFEST. Please remedy the situation and try again.
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

113
hdf5_1_8_10/bin/compile Executable file
View File

@@ -0,0 +1,113 @@
#! /bin/sh
#
# 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.
#
# Wrapper for compilers which do not understand `-c -o'.
# Copyright 1999, 2000 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# 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.
# Usage:
# compile PROGRAM [ARGS]...
# `-o FOO.o' is removed from the args passed to the actual compile.
prog=$1
shift
ofile=
cfile=
args=
while test $# -gt 0; do
case "$1" in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we do something ugly here.
ofile=$2
shift
case "$ofile" in
*.o | *.obj)
;;
*)
args="$args -o $ofile"
ofile=
;;
esac
;;
*.c)
cfile=$1
args="$args $1"
;;
*)
args="$args $1"
;;
esac
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$prog" $args
fi
# Name of file we expect compiler to create.
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir $lockdir > /dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir $lockdir; exit 1" 1 2 15
# Run the compile.
"$prog" $args
status=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
fi
rmdir $lockdir
exit $status

1526
hdf5_1_8_10/bin/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1658
hdf5_1_8_10/bin/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

40
hdf5_1_8_10/bin/debug-ohdr Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/perl
#
# 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.
#
require 5.003;
# Looks for lines emitted by H5O_open() and H5O_close() and tries to
# determine which objects were not properly closed.
while (<>) {
next unless /^([<>])(0x[\da-f]+|\d+)$/;
my ($op, $addr) = ($1, $2);
if ($op eq ">") {
# Open object
$obj{$addr} += 1;
} else {
# Close object
die unless $obj{$addr}>0;
$obj{$addr} -= 1;
delete $obj{$addr} unless $obj{$addr};
}
}
for (sort keys %obj) {
printf "%3d %s\n", $obj{$_}, $_;
}
exit 0;

529
hdf5_1_8_10/bin/depcomp Executable file
View File

@@ -0,0 +1,529 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-02-09.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# 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.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# 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-end: "$"
# End:

51
hdf5_1_8_10/bin/dependencies Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/perl -w
#
# 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.
#
my $depend_file;
my $new_depend_file;
my $srcdir;
my $top_srcdir;
my $top_builddir;
while ($_ = shift @ARGV) {
if (/^--top_srcdir=([^ \t\n]*)/) {
$top_srcdir = $1;
$top_srcdir =~ s/\+/\\\+/g;
$top_srcdir =~ s/\./\\\./g;
} elsif (/^--top_builddir=([^ \t\n]*)/) {
$top_builddir = $1;
$top_builddir =~ s/\+/\\\+/g;
$top_builddir =~ s/\./\\\./g;
} else {
$depend_file = $_;
$new_depend_file = "$_.new";
last;
}
}
open(DEPEND, "<$depend_file") || die "cannot open file $depend_file: $!\n";
open(NEW, ">$new_depend_file") || die "cannot open file $new_depend_file: $!\n";
while (<DEPEND>) {
s/\.o(\b)/\.lo$1/g;
s/ $top_srcdir/ \$\(top_srcdir\)/g;
s/ $top_builddir/ \$\(top_builddir\)/g;
print NEW $_;
}
close(DEPEND);
close(NEW);
`mv $new_depend_file $depend_file`;

60
hdf5_1_8_10/bin/deploy Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
#
# 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.
#
# Deploy the HDF5 binary.
#
# Programmer: Albert Cheng
# Created Date: 2004/12/15
#
# Modifications
# Function definitions
#
# Print Usage page
USAGE()
{
cat << EOF
Usage: $0 <dir>
Install the binary to directory <dir>
Examples:
$ bin/deploy /usr/local/hdf5
....
EOF
}
# Variables
if [ $# != 1 ]; then
USAGE
exit 1
fi
installdir=$1
# create installdir if it does not exist yet.
if [ -d $installdir ] || mkdir $installdir ; then
${MAKE:-gmake} install prefix=$installdir && \
( cd $installdir/bin; ./h5redeploy -force)
exit $?
else
echo $installdir is not a valid directory
USAGE
exit 1
fi

26
hdf5_1_8_10/bin/distdep Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/perl -p
#
# 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.
#
# Usage: $0 [<].depend
# Takes dependency info and generates on stdout dependencies suitable for
# distribution by removing all the system include files from the list and
# removing all but the base name of other include files (since the Makefiles
# contain the logic for searching).
($h,$_)=/\s*\\/?$h.$`:("",$h.$_);
s|( +/\S*)*( *)|$2?" \\\n ":""|eg;
#s|(([-\w\.]+)/)+([-\w\.]+)|\3|g;

140
hdf5_1_8_10/bin/errors Executable file
View File

@@ -0,0 +1,140 @@
#!/usr/local/bin/perl -w
require 5.003;
use Text::Tabs;
# NOTE: THE FORMAT OF HRETURN_ERROR AND HGOTO_ERROR MACROS HAS
# CHANGED. THIS SCRIPT NO LONGER WORKS! --rpm
# 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.
#
# Robb Matzke, matzke@llnl.gov
# 30 Aug 1997
#
# Purpose: This script will read standard input which should be a
# function prologue followed by a C function and will emit
# on standard output the same source code with the function
# prologue containing documentation for the various errors
# that occur in the function.
#
# Errors are raised by calling HGOTO_ERROR() or
# HRETURN_ERROR(). The reason for the error message is a
# comment which appears immediately after the error macro
# call and is contained entirely on one line:
#
# HRETURN_ERROR (...); /*entry not found*/
#
# If such a comment doesn't exist, then the previous comment
# is used, subject to the constraint that raising an error
# clears the previous comment.
#
# /* Entry not found */
# HGOTO_ERROR (...);
#
# Emacs users can use this script interactively with the
# c-mark-function and shell-command-on-region functions which
# are normally bound to M-C-h and M-|.
# Split STDIN into the prolog and the function body. Preserve leading
# white space.
$_ = join "", <STDIN>;
my ($head, $prolog, $body) = (/^(\s*)(\/\*(.*?)\*\/)?(.*)/s)[0,2,3];
$prolog = "" unless $prolog;
# Find each error and the comment that goes with it.
for ($_=$body,$comment=""; /\/\*|H(RETURN|GOTO)_ERROR/s;) {
$_ = $&.$';
if (/^H(RETURN|GOTO)_ERROR\s*\(\s*H5E_(\w+)\s*,\s*H5E_(\w+)\s*,/s) {
($major, $minor, $_) = ($2, $3, $');
$comment=$1 if /^.*?\)\s*;\s*\/\*\s*(.*?)\s*\*\//;
$comment =~ s/^\s*\*+\s*/ /mg; # leading asterisks.
$comment =~ s/^\s+//s; # leading white space.
$comment =~ s/\s+$//s; # trailing white space.
$comment =~ s/(\w)$/$1./s; # punctuation.
$comment ||= "***NO COMMENT***";
$errors{"$major\000$minor\000\u$comment"} = 1;
$comment = "";
} else {
($comment) = /^\/\*\s*(.*?)\s*\*\//s;
$_ = $';
}
}
# Format an error so it isn't too wide.
sub fmt_error ($) {
local ($_) = @_;
my ($prefix,$space,$err) = /^((.*?)([A-Z_0-9]+\s+[A-Z_0-9]+\s+))/;
$_ = $';
tr/\n / /s;
my $w = 70 - length expand $prefix;
s/(.{$w}\S+)\s+(\S)/$1."\n".$space.' 'x(length $err).$2/eg;
return $prefix . $_."\n";
}
# Sort the errors by major, then minor, then comment. Duplicate
# triplets have already been removed.
sub by_triplet {
my ($a_maj, $a_min, $a_com) = split /\000/, $a;
my ($b_maj, $b_min, $b_com) = split /\000/, $b;
$a_maj cmp $b_maj || $a_min cmp $b_min || $a_com cmp $b_com;
}
@errors = map {sprintf "%-9s %-13s %s\n", split /\000/}
sort by_triplet keys %errors;
# Add the list of errors to the prologue depending on the type of
# prolog.
if (($front, $back) = $prolog=~/^(.*?Errors:\s*?(?=\n)).*?\n\s*\*\s*\n(.*)/s) {
#| * Errors: |#
#| * __list_of_error_messages__ (zero or more lines) |#
#| * |#
print $head, "/*", $front, "\n";
map {print fmt_error " *\t\t".$_} @errors;
print " *\n", $back, "*/", $body;
} elsif (($front,$back) = $prolog =~
/(.*?\n\s*ERRORS:?\s*?(?=\n)).*?\n\s*\n(.*)/s) {
#| ERRORS |#
#| __list_of_error_messages__ (zero or more lines) |#
#| |#
print $head, "/*", $front, "\n";
map {print fmt_error " ".$_} @errors;
print "\n", $back, "*/", $body;
} elsif ($prolog eq "") {
# No prolog present.
print $head;
print " \n/*", "-"x73, "\n * Function:\t\n *\n * Purpose:\t\n *\n";
print " * Errors:\n";
map {print fmt_error " *\t\t".$_} @errors;
print " *\n * Return:\tSuccess:\t\n *\n *\t\tFailure:\t\n *\n";
print " * Programmer:\t\n *\n * Modifications:\n *\n *", '-'x73, "\n";
print " */\n", $body;
} else {
# Prolog format not recognized.
print $head, "/*", $prolog, "*/\n\n";
print "/*\n * Errors returned by this function...\n";
map {print fmt_error " *\t".$_} @errors;
print " */\n", $body;
}

53
hdf5_1_8_10/bin/gcov_script Executable file
View File

@@ -0,0 +1,53 @@
#! /bin/sh
#
# 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.
# A script to generate coverage files for HDF5 using gcov.
# Configures, builds, and runs tests in-place; the output files will be placed
# in a directory called gcov_logs.
# Must be invoked from the root hdf5 directory.
# This script has been tested on kagiso.
CFLAGS="$CFLAGS -ftest-coverage -fprofile-arcs"
export CFLAGS
LDFLAGS="$LDFLAGS -lgcov"
export LDFLAGS
CC=gcc
export CC
./configure
make
make check
mkdir gcov_logs
cd src
for j in *.h *.c
do
ln -s ../$j .libs/$j
done
cd .libs
for j in *.gcda
do
gcov -b $j >> gcov.log 2>&1
done
for j in *.gcov
do
mv $j ../../gcov_logs
done
mv gcov.log ../../gcov_logs
for j in *.c *.h
do
rm $j
done
cd ../..

417
hdf5_1_8_10/bin/h5vers Executable file
View File

@@ -0,0 +1,417 @@
#! /bin/sh
perl -x -S $0 "$@"
exit
#! perl
require 5.003;
use strict;
# 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.
#
# Robb Matzke <matzke@llnl.gov>
# 17 July 1998
### Purpose
# Increments the hdf5 version number by changing the value of
# constants in the src/H5public.h file. The new version number is
# printed on the standard output. An alternate source file name can be
# specified as an argument. In any case, the original file is saved
# by appending a tilde `~' to the name.
### Usage:
# h5vers [OPTIONS] [FILE]
# Without options this program only displays the current version and
# doesn't modify any files or create backups. The default is to print
# the version number like X.Y.Z-A where X is the major version number,
# Y is the minor version number, Z is the release number, and A is
# a short annotation string (the `-' is printed only if A is not empty).
# If the `-v' switch is given the version will be printed like:
#
# version X.Y release Z (A)
#
# The space and parentheses around A are only printed if A is not empty.
#
# The `-s VERSION' switch will set the version as specified. If the
# string contains a dotted triple then it will be used as the version
# number, otherwise up to three numbers will be read from the end of
# the string and used as the major version, minor version, and release
# number. If any numbers are missing then zero is assumed. This
# allows versions to be specified like `-s "version 2.1 release 8"' or
# `-s hdf5-2.1.8.tar.bz2'. If the new version is less than the old
# version then a warning message is generated on standard error. The
# annotation string, A, is set only if it appears immediately after the
# third number, separated by a dash (e.g., `1.2.3-pre1') or in parentheses
# (e.g., `version 1.2 release 3 (pre1)').
#
# The `-i [major|minor|release|annot|last]' option increments the major
# number, minor number, release number, or annotation string. The `last'
# switch increments the annotation string if present, otherwise the
# release number. If the release number is incremented then the annotation
# string is cleared. If the minor number is incremented then the release
# number is set to zero and the annotation string is cleared; if the major
# number is incremented then the minor and release numbers are set to zero
# and the annotation string is cleared.
#
# If a file is specified then that file is used instead of
# ./H5public.h or ./src/H5public.h.
#
# If the version number is changed (either `-s' or `-i' was used on
# 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.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.
#
# Whenever the version changes, this script will increment the revision
# field in HDF5's libtool shared library version in config/lt_vers.am,
# which is included in src/Makefile.am. Incrementing the revision field
# indicates that the source code has changed since the last version
# (which it probably has).
##############################################################################
sub getvers {
local ($_) = @_;
my (@vers);
($vers[0]) = /^\#\s*define\s+H5_VERS_MAJOR\s+(\d+)/m;
($vers[1]) = /^\#\s*define\s+H5_VERS_MINOR\s+(\d+)/m;
($vers[2]) = /^\#\s*define\s+H5_VERS_RELEASE\s+(\d+)/m;
($vers[3]) = /^\#\s*define\s+H5_VERS_SUBRELEASE\s+\"([^\"]*)\"/m;
return @vers;
}
sub setvers {
my ($contents, @vers) = @_;
$_[0] =~ s/^(\#\s*define\s+H5_VERS_MAJOR\s+)\d+/$1$vers[0]/m;
$_[0] =~ s/^(\#\s*define\s+H5_VERS_MINOR\s+)\d+/$1$vers[1]/m;
$_[0] =~ s/^(\#\s*define\s+H5_VERS_RELEASE\s+)\d+/$1$vers[2]/m;
$_[0] =~ s/^(\#\s*define\s+H5_VERS_SUBRELEASE\s+\")[^\"]*/$1$vers[3]/m;
$_[0] =~ s/^(\#\s*define\s+H5_VERS_INFO\s+\")[^\"]*/
sprintf("%sHDF5 library version: %d.%d.%d%s%s", $1, @vers[0,1,2],
$vers[3]?"-":"", $vers[3])/me;
}
sub usage {
my ($prog) = $0 =~ /([^\/]+)$/;
print STDERR <<EOF;
Usage: $prog [OPTS] [FILE]
-i major|minor|release|annot
Increment specified version component and set following components
to zero.
-s VERSION
Set the version as specified. The version number can be embedded in
some other string such as \"hdf5-1.1.0-pre1.tar.bz2\" or even
\"this is HDF5 library version 1.1 release 0 (pre1)\" for convenience.
-v
Instead of displaying only a dotted triple version number a line such
as \"version 1.1 release 0 (pre1)\" will be printed.
FILE
The name of the file that contains version information. This is
seldom necessary since files H5public.h, src/H5public.h and
../src/H5public.h are automatically checked.
EOF
exit 1;
}
# Parse arguments
my ($verbose, $set, $inc, $file, $rc);
my (@files) = ("H5public.h", "src/H5public.h", "../src/H5public.h");
while ($_ = shift) {
$_ eq "-s" && do {
die "-s switch needs a version number\n" unless @ARGV;
$set = shift;
next;
};
$_ eq "-i" && do {
if (@ARGV && $ARGV[0]=~/^(major|minor|release|annot)$/) {
$inc = shift;
} else {
$inc = "last";
}
next;
};
$_ eq "-v" && do {
$verbose = 1;
next;
};
/^-(h|\?|-?help)$/ && usage;
/^-/ && die "unrecognized option: $_\n";
die "only one file name can be specified\n" if $file;
$file = $_;
}
die "mutually exclusive options given\n" if $set && $inc;
# Determine file to use as H5public.h, README.txt,
# release_docs/RELEASE.txt, configure.ac, windows/src/H5pubconf.h,
# vms/src/h5pubconf.h and config/lt_vers.am.
# The README.txt, release_docs/RELEASE.txt, configure.ac,
# vms/src/h5pubconf.h, windows/src/H5pubconf.h, and config/lt_vers.am
# files are always in the directory above H5public.h
unless ($file) {
for (@files) {
($file=$_,last) if -f $_;
}
}
die "unable to find source files\n" unless defined $file;
die "unable to read file: $file\n" unless -r $file;
# config/lt_vers.am
my $LT_VERS = $file;
$LT_VERS =~ s/[^\/]*$/..\/config\/lt_vers.am/;
die "unable to read file: $LT_VERS\n" unless -r $file;
# README.txt
my $README = $file;
$README =~ s/[^\/]*$/..\/README.txt/;
die "unable to read file: $README\n" unless -r $file;
# release_docs/RELEASE.txt
my $RELEASE = $file;
$RELEASE =~ s/[^\/]*$/..\/release_docs\/RELEASE.txt/;
die "unable to read file: $RELEASE\n" unless -r $file;
# configure.ac
my $CONFIGURE = $file;
$CONFIGURE =~ s/[^\/]*$/..\/configure.ac/;
die "unable to read file: $CONFIGURE\n" unless -r $file;
# windows/src/H5pubconf.h
my $H5PUBCONF = $file;
$H5PUBCONF =~ s/[^\/]*$/..\/windows\/src\/H5pubconf.h/;
die "unable to read file: $H5PUBCONF\n" unless -r $file;
# vms/src/h5pubconf.h
my $H5VMSPUBCONF = $file;
$H5VMSPUBCONF =~ s/[^\/]*$/..\/vms\/src\/h5pubconf.h/;
die "unable to read file: $H5VMSPUBCONF\n" unless -r $file;
# Get the current version number.
open FILE, $file or die "unable to open $file: $!\n";
my ($contents) = join "", <FILE>;
close FILE;
my (@curver) = getvers $contents;
# Determine the new version number.
my @newver; #new version
if ($set) {
if ($set =~ /(\d+)\.(\d+)\.(\d+)(-([a-zA-Z]\w*))?/) {
@newver = ($1, $2, $3, $5);
} elsif ($set =~ /(\d+)\D+(\d+)\D+(\d+)(\s*\(([a-zA-Z]\w*)\))?\D*$/) {
@newver = ($1, $2, $3, $5);
} elsif ($set =~ /(\d+)\D+(\d+)\D*$/) {
@newver = ($1, $2, 0, "");
} elsif ($set =~ /(\d+)\D*$/) {
@newver = ($1, 0, 0, "");
} else {
die "illegal version number specified: $set\n";
}
} elsif ($inc) {
$inc = $curver[3] eq "" ? 'release' : 'annot' if $inc eq 'last';
if ($inc eq "major") {
$newver[0] = $curver[0]+1;
@newver[1,2,3] = (0,0,"");
} elsif ($inc eq "minor") {
$newver[0] = $curver[0];
$newver[1] = $curver[1]+1;
@newver[2,3] = (0,"");
} elsif ($inc eq "release") {
@newver[0,1] = @curver[0,1];
$newver[2] = $curver[2]+1;
$newver[3] = "";
} elsif ($inc eq "annot") {
@newver[0,1,2] = @curver[0,1,2];
$newver[3] = $curver[3];
$newver[3] =~ s/(\d+)\D*$/$1+1/e or
die "Annotation \"".$newver[3]."\" cannot be incremented.\n";
} else {
die "unknown increment field: $inc\n";
}
} else {
# Nothing to do but print result
$README = "";
$RELEASE = "";
$CONFIGURE = "";
$H5PUBCONF = "";
$H5VMSPUBCONF = "";
$LT_VERS = "";
@newver = @curver;
}
# Note if the version increased or decreased
my $version_increased="";
# Print a warning if the version got smaller (don't check annot field)
if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] <
$curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
printf STDERR "Warning: version decreased from %d.%d.%d to %d.%d.%d\n",
@curver[0,1,2], @newver[0,1,2];
}
if ($newver[0]*1000000 + $newver[1]*1000 + $newver[2] >
$curver[0]*1000000 + $curver[1]*1000 + $curver[2]) {
$version_increased="true";
}
# Update the version number if it changed.
if ($newver[0]!=$curver[0] ||
$newver[1]!=$curver[1] ||
$newver[2]!=$curver[2] ||
$newver[3]ne$curver[3]) {
setvers $contents, @newver or die "unable to set version\n";
rename $file, "$file~" or die "unable to save backup file\n";
open FILE, ">$file" or die "unable to open $file but backup saved!\n";
print FILE $contents;
close FILE;
}
# Update the libtool shared library version in src/Makefile.am if
# the version number has increased.
if ($LT_VERS && $version_increased) {
open FILE, $LT_VERS or die "$LT_VERS: $!\n";
my ($contentsy) = join "", <FILE>;
close FILE;
local($_) = $contentsy;
my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m;
my $new_lt_revision = $lt_revision+1;
($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m;
open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n";
print FILE $contentsy;
close FILE;
}
# Update the README.txt file
if ($README) {
open FILE, $README or die "$README: $!\n";
my @contents = <FILE>;
close FILE;
$contents[0] = sprintf("HDF5 version %d.%d.%d%s %s",
@newver[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3],
"currently under development\n");
open FILE, ">$README" or die "$README: $!\n";
print FILE @contents;
close FILE;
}
# Update the release_docs/RELEASE.txt file
if ($RELEASE) {
open FILE, $RELEASE or die "$RELEASE: $!\n";
my @contents = <FILE>;
close FILE;
$contents[0] = sprintf("HDF5 version %d.%d.%d%s %s",
@newver[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3],
"currently under development\n");
open FILE, ">$RELEASE" or die "$RELEASE: $!\n";
print FILE @contents;
close FILE;
}
sub gen_configure {
my ($name, $conf) = @_;
open FILE, $conf or die "$conf: $!\n";
my @contents = <FILE>;
close FILE;
for (my $i = 0; $i < $#contents; ++$i) {
if ($contents[$i] =~ /^AC_INIT/) {
$contents[$i] = sprintf("AC_INIT([$name], [%d.%d.%d%s], [help\@hdfgroup.org])\n",
@newver[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3]);
last;
}
}
open FILE, ">$conf" or die "$conf: $!\n";
print FILE @contents;
close FILE;
$conf =~ /^(.*?)\/?configure.ac$/;
if ($1) {
$rc = system("cd $1 && bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
} else {
$rc = system("bin/reconfigure >/dev/null 2>/dev/null && rm -rf autom4te.cache");
}
if ($rc) {
printf("bin/reconfigure failed with exit code %d. Aborted.\n", $rc);
exit 1;
}
}
# Update the configure.ac files and regenerate them
gen_configure("HDF5", $CONFIGURE) if $CONFIGURE;
sub gen_h5pubconf {
my ($name, $pubconf, @vers) = @_;
my $namelc = lc($name);
my $nameuc = uc($name);
open FILE, $pubconf or die "$pubconf: $!\n";
my @contents = <FILE>;
close FILE;
for (my $i = 0; $i < $#contents; ++$i) {
if ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE\s+/) {
$contents[$i] = "\#define H5_PACKAGE \"$namelc\"\n";
} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_NAME\s+/) {
$contents[$i] = "\#define H5_PACKAGE_NAME \"$nameuc\"\n";
} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_STRING\s+/) {
$contents[$i] = sprintf("\#define H5_PACKAGE_STRING \"$nameuc %d.%d.%d%s\"\n",
@vers[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3]);
} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_TARNAME\s+/) {
$contents[$i] = "\#define H5_PACKAGE_TARNAME \"$namelc\"\n";
} elsif ($contents[$i] =~ /\#\s*define\s+H5_PACKAGE_VERSION\s+/) {
$contents[$i] = sprintf("\#define H5_PACKAGE_VERSION \"%d.%d.%d%s\"\n",
@vers[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3]);
} elsif ($contents[$i] =~ /\#\s*define\s+H5_VERSION\s+/) {
$contents[$i] = sprintf("\#define H5_VERSION \"%d.%d.%d%s\"\n",
@vers[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3]);
}
}
open FILE, ">$pubconf" or die "$pubconf: $!\n";
print FILE @contents;
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],
$newver[3] eq "" ? "" : " (".$newver[3].")");
} else {
printf("%d.%d.%d%s\n", @newver[0,1,2],
$newver[3] eq "" ? "" : "-".$newver[3]);
}
exit 0;
# Because the first line of this file looks like a Bourne shell script, we
# must tell XEmacs explicitly that this is really a perl script.
#
# Local Variables:
# mode:perl
# End:

520
hdf5_1_8_10/bin/install-sh Executable file
View File

@@ -0,0 +1,520 @@
#!/bin/sh
# install - install a program, script, or datafile
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 (C) 1994 X Consortium
#
# 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.
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-}
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.
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}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-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.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-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
# 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
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'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
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
mkdir_mode=
fi
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 (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
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
prefix=$prefix/
done
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
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
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# 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 -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` &&
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
# 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:

99
hdf5_1_8_10/bin/iostats Executable file
View File

@@ -0,0 +1,99 @@
#!/usr/bin/perl
#
# 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.
#
# Usage: pipe the output of Linux's `strace' program into the stdin of
# this command, and the output of this command into gnuplot.
my ($fast,$npasses);
if ($ARGV[0] =~ /^--?fast$/) {
$fast = 1;
shift;
}
my $filename = shift || "tstab2.h5";
my $total = 0;
my %What; # What{pos}{nbytes}{r|w} = naccesses
my($total_writes, $total_bytes_out, $total_reads, $total_bytes_in);
while (<>) {
if (!defined $fd) {
if (/^open\("(.*?)".*=\s+(\d+)/ && $1 eq $filename) {
$fd = $2;
$pos = 0;
}
} elsif (/^close\((\d+)/ && $1==$fd) {
$fd = undef;
} elsif (!$fast &&
/^lseek\((\d+), -?\d+,.*= (\d+)/ &&
$1==$fd && $2>=0) {
$pos = $2;
} elsif (!$fast && /^lseek\((\d+),/ && $1==$fd) {
die $_;
} elsif (/^write\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ &&
$1==$fd && $3>=0) {
my $nbytes = $3;
if ($fast) {
$total_writes++;
$total_bytes_out += $nbytes;
} else {
$What{$pos}{$nbytes}{w}++;
printf "%d %d\n", $total, $pos;
$pos += $nbytes;
$total += $nbytes;
}
} elsif (/^write\((\d+),/ && $1==$fd) {
die $_;
} elsif (/^read\((\d+), ".*?"(\.\.\.)?, \d+\)\s*= (\d+)/ &&
$1==$fd && $3>=0) {
my $nbytes = $3;
if ($fast) {
$total_reads++;
$total_bytes_in += $nbytes;
} else {
$What{$pos}{$nbytes}{r}++;
printf "%d %d\n", $total, $pos;
$pos += $nbytes;
$total += $nbytes;
}
} elsif (/^read\((\d+),/ && $1==$fd) {
die $_;
}
}
if (!$fast) {
print "="x36, "\n";
printf "%8s %8s %8s %8s\n","Position","NBytes","NReads","NWrites";
for $pos (sort {$a<=>$b} keys %What) {
for $nbytes (sort {$a<=>$b} keys %{$What{$pos}}) {
printf("%8d %8d %8d %8d\n", $pos, $nbytes,
$What{$pos}{$nbytes}{r},
$What{$pos}{$nbytes}{w});
$total_writes += $What{$pos}{$nbytes}{w};
$total_reads += $What{$pos}{$nbytes}{r};
$total_bytes_out += $What{$pos}{$nbytes}{w} * $nbytes;
$total_bytes_in += $What{$pos}{$nbytes}{r} * $nbytes;
}
}
}
print "="x36, "\n";
printf("Write: %8d calls, %10d total bytes, %10g average bytes\n",
$total_writes, $total_bytes_out, $total_bytes_out/$total_writes)
if $total_writes;
printf("Read: %8d calls, %10d total bytes, %10g average bytes\n",
$total_reads, $total_bytes_in, $total_bytes_in/$total_reads)
if $total_reads;

297
hdf5_1_8_10/bin/locate_sw Executable file
View File

@@ -0,0 +1,297 @@
#!/bin/sh
#
# 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.
#
# Try to locate the software as named in argument.
# This is a sequential search of all possible locations of the software.
# Usage: locate_sw <SW-Name>
# It prints a string showing the paths leading to the include, lib and bin
# directory of the software, separated by colons. E.g., if the software is
# located in /usr/sdt/*, it prints
# /usr/sdt/include:/usr/sdt/lib:/usr/sdt/bin
# Any component that is not found will be returned as an empty string. E.g.,
# if somehow the header files of the software are not found, it prints
# :/usr/sdt/lib;/usr/sdt/bin
# Function definitions
USAGE()
{
echo "Usage: locate_sw <SW-Name>"
echo " where <SW-Name> can be hdf4, hdf5, zlib"
echo " It prints the paths leading the header files (include),"
echo " library (lib), and tools (bin). E.g.,"
echo " /usr/sdt/include:/usr/sdt/lib:/usr/sdt/bin"
echo " Any component that is not found will be returned as an empty string. E.g.,"
echo " if somehow the header files of the software are not found, it prints"
echo " :/usr/sdt/lib;/usr/sdt/bin"
echo "Exit code: 0 if software located; otherwise non-zero"
}
# locate hdf4 software
locate_hdf4()
{
# this default is the best guess of locating hdf4 software
swpaths_defaults="/usr/ncsa /usr/sdt /usr/local"
swpaths=
case "$OSname" in
SunOS)
case "$OSrelease" in
5.7)
swpaths="/afs/ncsa/packages/hdf/SunOS_5.7"
;;
*)
# use default
;;
esac
;;
HP-UX)
case "$OSrelease" in
B.11.00)
swpaths="/afs/ncsa/packages/hdf/HPUX_11.00"
;;
*)
# use default
;;
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"
;;
OSF1)
swpaths="/afs/ncsa/packages/hdf/OSF1_V4.0"
;;
*)
# just use the defaults
;;
esac
# Check if the hdf4 software is actually available.
# Accept the directory only if needed .h, .a and tools are found
# in the same place. That way, they are more likely to be of the
# same version.
#
swpaths="$swpaths $swpaths_defaults"
for sw in $swpaths; do
if [ -r $sw/include/hdf.h -a -r $sw/lib/libdf.a -a -r $sw/bin/hdp ]; then
SW_inc=$sw/include
SW_lib=$sw/lib
SW_bin=$sw/bin
SW_Location=$sw
break
fi
done
}
# locate hdf5 software
locate_hdf5()
{
# this default is the best guess of locating hdf5 software
swpaths_defaults="/usr/ncsa /usr/sdt /usr/local"
swpaths=
case "$OSname" in
SunOS)
case "$OSrelease" in
5.7)
swpaths="/afs/ncsa/packages/hdf5/SunOS_5.7"
;;
*)
# use default
;;
esac
;;
HP-UX)
case "$OSrelease" in
B.11.00)
swpaths="/afs/ncsa/packages/hdf5/HPUX_11.00"
;;
*)
# use default
;;
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"
;;
FreeBSD)
swpaths="/afs/ncsa/packages/hdf5/FreeBSD"
;;
OSF1)
swpaths="/afs/ncsa/packages/hdf5/OSF1_V4.0"
;;
*)
# just use the defaults
;;
esac
# Check if the hdf5 software is actually available.
# Accept the directory only if needed .h, .a and tools are found
# in the same place. That way, they are more likely to be of the
# same version.
#
swpaths="$swpaths $swpaths_defaults"
for sw in $swpaths; do
if [ -r $sw/include/hdf5.h -a -r $sw/lib/libhdf5.a -a -r $sw/bin/h5dump ]; then
SW_inc=$sw/include
SW_lib=$sw/lib
SW_bin=$sw/bin
SW_Location=$sw
break
fi
done
}
# locate zlib software
locate_zlib()
{
# this default is the best guess of locating zlib software
swpaths_defaults="/usr /usr/local /usr/ncsa /usr/sdt"
swpaths=
# Check if the zlib software is actually available.
# Accept the directory only if needed .h, .a and tools are found
# in the same place. That way, they are more likely to be of the
# same version.
# Don't know something specific to check the bin directory. Maybe gzip?
# Just make sure it exists.
#
swpaths="$swpaths $swpaths_defaults"
for sw in $swpaths; do
if [ -r $sw/include/zlib.h -a \
\( -r $sw/lib/libz.a -o -r $sw/lib/libz.so \) -a -d $cw/bin ]; then
SW_inc=$sw/include
SW_lib=$sw/lib
SW_bin=$sw/bin
SW_Location=$sw
break
fi
done
# if none found, try HDF4 software which contains a version of zlib.
if [ x-$SW_Location = x- ]; then
locate_hdf4
fi
}
# Main
#
# Options
#
if [ $# -lt 1 ]; then
USAGE
exit 1
fi
if [ "$1" = -h ]; then
USAGE
exit 0
fi
SW=$1
shift
# locations of the software seeked.
SW_inc= # include place
SW_lib= # library place
SW_bin= # binary place
SW_Location= # parent directory of all the above
OSname=`uname -s`
OSrelease=`uname -r`
case $SW in
hdf4|hdf)
locate_hdf4
;;
hdf5)
locate_hdf5
;;
zlib)
locate_zlib
;;
*)
echo "unknown software ($SW)"
USAGE
exit 1
;;
esac
# show the results located, separated by commas.
if [ -n "${SW_inc}" -a -n "${SW_lib}" -a -n "${SW_bin}" ]; then
echo ${SW_inc},${SW_lib},${SW_bin}
exit 0
else
exit 1
fi

9655
hdf5_1_8_10/bin/ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

390
hdf5_1_8_10/bin/make_err Executable file
View File

@@ -0,0 +1,390 @@
#!/usr/bin/perl -w
require 5.003;
$indent=4;
#
# 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 error headers
#
# Read in the error description text file and create the appropriate headers
# needed by the library.
#
# Programmer: Quincey Koziol
# Creation Date: 2003/08/12
##############################################################################
# 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_err -- do not edit */\n";
print $fh "/* Add new errors to H5err.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 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 "\n#endif /* ${file}_H */\n";
}
##############################################################################
# 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
my $name; # The name of the error message
my $desc; # The description of the error message
# Parse major error lines
#print "line=$line\n";
if($line =~ /^\s*MAJOR,/) {
# Get the major error's name & description
($name, $desc) = ($line =~ /^\s*MAJOR,\s*(\w*),\s*(.*)\n/);
#print "MAJOR: name=$name, desc=$desc\n";
# Check if the name already exists as a major or minor error message
if(exists($major{$name}) || exists($minor{$name})) {
die "duplicated name: $name";
}
# Store the major errors in a hash table, indexed by the name
$major{$name}=$desc;
}
# Parse minor error lines
elsif($line =~ /^\s*MINOR,/) {
my $min_section; # Minor errors have a section they below to also
# Get the minor error's section, name & description
($min_section, $name, $desc) = ($line =~ /^\s*MINOR,\s*(\w*),\s*(\w*),\s*(.*)\n/);
#print "MINOR: min_section=$min_section, name=$name, desc=$desc\n";
# Check for valid section
if(!exists($section{$min_section})) {
die "unknown section: $min_section";
}
# Check if the name already exists as a major or minor error message
if(exists($major{$name}) || exists($minor{$name})) {
die "duplicated name: $name";
}
# Store the minor errors in a hash table, indexed by the name
$minor{$name}=$desc;
# Add the minor error to the list for the section
push @{$section_list{$min_section}}, $name;
}
# Parse section lines
elsif($line =~ /^\s*SECTION,/) {
# Get the section's name & description
($name, $desc) = ($line =~ /^\s*SECTION,\s*(\w*),\s*(.*)\n/);
#print "SECTION: name=$name, desc=$desc\n";
# Check if the section has already been defined
if(exists($section{$name})) {
die "duplicated name: $name";
}
# Store the section in a hash table, indexed by the name
$section{$name}=$desc;
}
# Unknown keyword
else {
die "unknown keyword: $line";
}
}
##############################################################################
# Create the generated portion of the public header file
#
sub create_public ($) {
my $prefix = shift; # Get the prefix for the generated file
my $file = "H5Epubgen.h"; # Name of file to generate
my $name; # Name of error message
my $desc; # Description of error message
my $sect_name; # Section of minor error messages
my $sect_desc; # Description of section
# 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);
# Iterate over all the major errors
print HEADER "\n/*********************/\n";
print HEADER "/* Major error codes */\n";
print HEADER "/*********************/\n\n";
foreach $name (keys %major) {
printf HEADER "#define %-20s (H5OPEN %s_g)\n",$name,$name;
}
foreach $name (keys %major) {
printf HEADER "H5_DLLVAR hid_t %-20s /* %s */\n","${name}_g;",$major{$name};
}
# Iterate over all the minor error sections
print HEADER "\n/*********************/\n";
print HEADER "/* Minor error codes */\n";
print HEADER "/*********************/\n";
while ( ($sect_name, $sect_desc) = each (%section)) {
print HEADER "\n/* $sect_desc */\n";
# Iterate over all the minor errors in each section
for $name ( @{$section_list{$sect_name}}) {
printf HEADER "#define %-20s (H5OPEN %s_g)\n",$name,$name;
}
for $name ( @{$section_list{$sect_name}}) {
printf HEADER "H5_DLLVAR hid_t %-20s /* %s */\n","${name}_g;",$minor{$name};
}
}
print_endprotect(*HEADER, $file);
# Close header file
close HEADER;
}
##############################################################################
# Create the generated portion of the H5E initialization code
#
sub create_init ($) {
my $prefix = shift; # Get the prefix for the generated file
my $file = "H5Einit.h"; # Name of file to generate
my $name; # Name of error message
my $desc; # Description of error message
my $sect_name; # Section of minor error messages
my $sect_desc; # Description of section
# 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);
# Iterate over all the major errors
print HEADER "\n/*********************/\n";
print HEADER "/* Major error codes */\n";
print HEADER "/*********************/\n\n";
foreach $name (keys %major) {
print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n";
print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MAJOR, \"${major{$name}}\"))==NULL)\n";
print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n";
print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n";
print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n";
}
# Iterate over all the minor error sections
print HEADER "\n/*********************/\n";
print HEADER "/* Minor error codes */\n";
print HEADER "/*********************/\n\n";
while ( ($sect_name, $sect_desc) = each (%section)) {
print HEADER "\n"," "x(0*$indent),"/* $sect_desc */\n";
# Iterate over all the minor errors in each section
for $name ( @{$section_list{$sect_name}}) {
print HEADER " "x(0*$indent),"assert(${name}_g==(-1));\n";
print HEADER " "x(0*$indent),"if((msg = H5E_create_msg(cls, H5E_MINOR, \"${minor{$name}}\"))==NULL)\n";
print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, \"error message initialization failed\")\n";
print HEADER " "x(0*$indent),"if((${name}_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)\n";
print HEADER " "x(1*$indent),"HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, \"can't register error message\")\n";
}
}
print_endprotect(*HEADER, $file);
# Close header file
close HEADER;
}
##############################################################################
# Create the generated portion of the H5E termination code
#
sub create_term ($) {
my $prefix = shift; # Get the prefix for the generated file
my $file = "H5Eterm.h"; # Name of file to generate
my $name; # Name of error message
my $desc; # Description of error message
my $sect_name; # Section of minor error messages
my $sect_desc; # Description of section
# 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);
# Iterate over all the major errors
print HEADER "\n/* Reset major error IDs */\n";
foreach $name (keys %major) {
print HEADER " "x($indent),"\n${name}_g=";
}
print HEADER " (-1);\n";
# Iterate over all the minor error sections
print HEADER "\n/* Reset minor error IDs */\n";
while ( ($sect_name, $sect_desc) = each (%section)) {
print HEADER "\n"," "x(0*$indent),"\n/* $sect_desc */";
# Iterate over all the minor errors in each section
for $name ( @{$section_list{$sect_name}}) {
print HEADER " "x($indent),"\n${name}_g=";
}
}
print HEADER " (-1);\n";
print_endprotect(*HEADER, $file);
# Close header file
close HEADER;
}
##############################################################################
# Create the generated portion of the error code definitions
#
sub create_define ($) {
my $prefix = shift; # Get the prefix for the generated file
my $file = "H5Edefin.h"; # Name of file to generate
my $name; # Name of error message
my $desc; # Description of error message
my $sect_name; # Section of minor error messages
my $sect_desc; # Description of section
# 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);
# Iterate over all the major errors
print HEADER "\n/* Major error IDs */\n";
foreach $name (keys %major) {
printf HEADER "hid_t %-20s = FAIL; /* %s */\n","${name}_g",$major{$name};
}
# Iterate over all the minor error sections
print HEADER "\n/* Minor error IDs */\n";
while ( ($sect_name, $sect_desc) = each (%section)) {
print HEADER "\n/* $sect_desc */\n";
# Iterate over all the minor errors in each section
for $name ( @{$section_list{$sect_name}}) {
printf HEADER "hid_t %-20s = FAIL; /* %s */\n","${name}_g",$minor{$name};
}
}
print_endprotect(*HEADER, $file);
# Close header file
close HEADER;
}
##############################################################################
# Read error file (given as command-line argument) in and process it into
# internal data structures, then create error header files.
#
for $file (@ARGV) {
my $prefix; # Local prefix for generated files
($prefix) = ($file =~ /(^.*\/)/);
# Read in the entire file
open SOURCE, $file or die "$file: $!\n";
while ( defined ($line=<SOURCE>) ) {
if(!($line =~ /(^\s*#.*$)|(^\s*$)/)) {
# Construct data structures for later printing
parse_line($line);
}
}
close SOURCE;
# Create header files
print "Generating 'H5Epubgen.h'\n";
create_public($prefix);
print "Generating 'H5Einit.h'\n";
create_init($prefix);
print "Generating 'H5Eterm.h'\n";
create_term($prefix);
print "Generating 'H5Edefin.h'\n";
create_define($prefix);
}

219
hdf5_1_8_10/bin/make_overflow Executable file
View 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);
}

462
hdf5_1_8_10/bin/make_vers Executable file
View File

@@ -0,0 +1,462 @@
#!/usr/bin/perl -w
require 5.003;
# Global settings
# Max. library "index" (0 = v1.0, 1 = 1.2, etc)
$max_idx = 4;
# Min. supported previous library version "index" (0 = v1.0, 1 = 1.2, etc)
$min_sup_idx = 3;
#
# 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 public symbol version headers
#
# Read in the public symbol version description text file and create the
# appropriate headers needed by the library.
#
# Programmer: Quincey Koziol
# Creation Date: 2007/07/10
##############################################################################
# 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_vers -- do not edit */\n";
print $fh "/* Add new versioned symbols to H5vers.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 check for conflicting version macro settings
#
sub print_checkoptions ($) {
my $fh = shift;
# 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 "global" API version macro settings
#
sub print_globalapivers ($) {
my $fh = shift; # File handle for output file
my $curr_idx; # Current API version index
# Print the descriptive comment
print $fh "\n\n/* If a particular \"global\" version of the library's interfaces is chosen,\n";
print $fh " * set the versions for the API symbols affected.\n";
print $fh " *\n";
print $fh " * Note: If an application has already chosen a particular version for an\n";
print $fh " * API symbol, the individual API version macro takes priority.\n";
print $fh " */\n";
for $curr_idx ($min_sup_idx .. ($max_idx - 1)) {
# 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 API version endif
print $fh "#endif /* H5_USE_1", ($curr_idx * 2), "_API_DEFAULT && !H5_USE_1", ($curr_idx * 2), "_API */\n\n";
}
# 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 the version macro info for each function that is defined for
# this API version
print $fh "\n/*************/\n";
print $fh "/* Functions */\n";
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 "#endif /* !defined(", $name, "_vers) */\n";
}
# Print the version macro info for each typedef that is defined for
# this API version
print $fh "\n/************/\n";
print $fh "/* Typedefs */\n";
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 "#endif /* !defined(", $name, "_t_vers) */\n";
}
# Print API version endif
print $fh "\n#endif /* H5_USE_1", ($curr_idx * 2), "_API */\n";
}
}
##############################################################################
# Print "default" API version macro settings
#
sub print_defaultapivers ($) {
my $fh = shift; # File handle for output file
my $curr_name; # Current API function
# Print the descriptive comment
print $fh "\n\n/* Choose the correct version of each API symbol, defaulting to the latest\n";
print $fh " * version of each. The \"best\" name for API parameters/data structures\n";
print $fh " * that have changed definitions is also set. An error is issued for\n";
print $fh " * specifying an invalid API version.\n";
print $fh " */\n";
# Loop over function names that are versioned and set up the version macros
print $fh "\n/*************/\n";
print $fh "/* Functions */\n";
print $fh "/*************/\n";
for $curr_name (sort keys %functions) {
my $curr_vers_name; # Name of version macro for current function
my $curr_vers; # Version of function
my @param_list; # Typedefs for the function parameters
# Set up variables for later use
$curr_vers_name = $curr_name . "_vers";
$curr_vers = $functions{$curr_name};
# Split up parameter info
@param_list = split(/\s*,\s*/, $func_params{$curr_name});
#print "print_defaultapivers: param_list=(@param_list)\n";
# 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 function's dependent parameter types
foreach(sort(@param_list)) {
print $fh "#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 function's dependent parameter types
foreach(sort(@param_list)) {
print $fh "#define ${_}_t $_${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 "#endif /* $curr_vers_name */\n";
}
# Loop over typedefs that are versioned and set up the version macros
print $fh "\n/************/\n";
print $fh "/* Typedefs */\n";
print $fh "/************/\n";
for $curr_name (sort keys %typedefs) {
my $curr_vers_name; # Name of version macro for current function
my $curr_vers; # Version of function
# Set up variables for later use
$curr_vers_name = $curr_name . "_t_vers";
$curr_vers = $typedefs{$curr_name};
# 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";
# 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";
$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 "#endif /* $curr_vers_name */\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";
}
##############################################################################
# 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 API function lines
#print "line=$line\n";
if($line =~ /^\s*FUNCTION:/ || $line =~ /^\s*TYPEDEF:/) {
my $name; # The name of the function
my $params; # Typedefs for function parameters
my $vers; # The version info for the function
my @vers_list; # Version info, as a 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
my $last_vers; # The previous version # seen for a function
my $line_type; # Type of line we are parsing
# Determine the type of the line to parse
if($line =~ /^\s*FUNCTION:/) {
$line_type = 1;
# Get the function's name & version info
($name, $params, $vers) = ($line =~ /^\s*FUNCTION:\s*(\w*);\s*(.*?)\s*;\s*(.*?)\s*$/);
#print "parse_line: name='$name', params='$params', vers='$vers'\n";
}
elsif($line =~ /^\s*TYPEDEF:/) {
$line_type = 2;
# Get the typedefs's name & version info
($name, $vers) = ($line =~ /^\s*TYPEDEF:\s*(\w*);\s*(.*?)\s*$/);
#print "parse_line: name='$name', vers='$vers'\n";
}
#print "parse_line: line_type='$line_type'\n";
# Check if the name already exists in the list of symbols
if(exists($functions{$name}) || exists($typedefs{$name})) {
die "duplicated symbol: $name";
}
# Check for no version info given
if($vers eq "") {
die "no version information: $name";
}
# Split up version info
@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)) {
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]/)) {
die "bad version information: $name";
}
if(exists($sym_versions{$_})) {
die "duplicate version information: $name";
}
# Store the versions for the function in a local hash table, indexed by the version
$sym_versions{$_}=$_;
# Get the index of the version
($vers_idx) = ($_ =~ /v1(\d)/);
$vers_idx /= 2;
#print "parse_line: vers_idx='$vers_idx'\n";
# Update intermediate versions of the library that included the API routine
if($last_idx >= 0) {
#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) {
if($line_type == 1) {
$func_vers[$last_idx]{$name} = $last_vers;
} elsif($line_type == 2) {
$type_vers[$last_idx]{$name} = $last_vers;
} else {
die "unknown line type: $line";
}
$last_idx++;
}
# Increment the version # of the function
$last_vers++;
}
# Keep track of last version index seen
$last_idx = $vers_idx;
}
# Finish updating versions of the library that included the API routine
if($last_idx >= 0) {
#print "parse_line: max_idx='$max_idx'\n";
# Add the function to the list of API routines available in
# different versions of the library
while($last_idx <= $max_idx) {
if($line_type == 1) {
$func_vers[$last_idx]{$name} = $last_vers;
} elsif($line_type == 2) {
$type_vers[$last_idx]{$name} = $last_vers;
} else {
die "unknown line type: $line";
}
$last_idx++;
}
}
# Store the number of symbol versions in a hash table, indexed by the name
if($line_type == 1) {
$functions{$name} = $#vers_list + 1;
# Store the function's parameter types for later
$func_params{$name} = $params;
} elsif($line_type == 2) {
$typedefs{$name} = $#vers_list + 1;
} else {
die "unknown line type: $line";
}
}
# Unknown keyword
else {
die "unknown keyword: $line";
}
}
##############################################################################
# Create the generated portion of the public header file
#
sub create_public ($) {
my $prefix = shift; # Get the prefix for the generated file
my $file = "H5version.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_checkoptions(*HEADER);
print_globalapivers(*HEADER);
print_defaultapivers(*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.
#
for $file (@ARGV) {
my $prefix; # Local prefix for generated files
#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 'H5version.h'\n";
create_public($prefix);
#for $name (sort keys %functions) {
# print "functions{$name} = $functions{$name}\n";
#}
#for $i (0 .. $#func_vers) {
# my $vers_name; # Name of indexed version
# $vers_name = "v1." . ($i * 2);
# print "$vers_name functions: ";
# for $name (sort keys %{$func_vers[$i]}) {
# print "$name$func_vers[$i]{$name} ";
# }
# print "\n";
#}
}

65
hdf5_1_8_10/bin/makehelp Executable file
View File

@@ -0,0 +1,65 @@
cat << EOF
Help for HDF5 Makefiles
For help with the make utility itself, try 'man make'.
HDF5 makefiles are used to build, test, and install HDF5. The exact
behavior and output will depend on your system's version of make, compiler,
etc.
Usage: make [make options] [TARGET]
Targets:
make help: print this help message
make, make all: (default if no target is specified)
builds all libraries, tools, and tests
make lib: builds libraries only
make progs: builds libraries and programs
make tests: builds libraries, programs, and tests.
Essentially the same as 'make all'.
make check, make tests,
make _test, make test: Run HDF5's test suite.
Make will exit with a failure if any tests fail.
make install: install HDF5 libraries, include files, and tools
make install-examples: installs example source files
make install-all: runs both make-install and make install-examples
make check-install: test building examples with installed HDF5 library
make uninstall: remove installed files
make install-examples: removes example source files
make uninstall-all: removes both installed libraries and examples
make check-clean: remove files generated by running tests
(allows tests to be re-run)
make mostlyclean: remove intermediate files (*.o files).
Doesn't clean libraries or executables.
make clean: remove all files generated by make or make check
make distclean: remove all files generated by make, make check, or
configure
make check-p: Only run parallel tests
make check-s: Only run serial tests
make check-vfd: Run tests with each virtual file driver
HDF5 uses Automake, so any standard Automake targets not listed here
should also work.
Configure options that affect Makefile behavior:
--enable-fortran, --enable-cxx, --enable-parallel, and --disable-hl
enable or disable various interfaces. Make will only recurse into these
directories if they are specified at configure time.
--prefix=[path], --libdir=[path], --includedir=[path], etc. can be used
to change the directory into which make install puts files.
--enable-build-all causes make to build some files that are only
needed by developers (test file generation programs).
Environment variables that affect Makefile behavior:
Make will honor environment variables like CFLAGS that are used when building and linking.
The variable HDF5TestExpress can be used to control the running time
of the tests. HDF5TestExpress = 0 is a full run of the tests while
to run make check. 1 and 2 are intermediate values. The default value is 1.
Available command-line options for make depend on the version of make installed
on your system. Try 'man make'.
EOF

357
hdf5_1_8_10/bin/missing Executable file
View File

@@ -0,0 +1,357 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2005-02-08.22
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally 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
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# 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.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# 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
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
;;
-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.
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]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
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.
;;
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
;;
*)
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
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

35
hdf5_1_8_10/bin/mkdirs Executable file
View File

@@ -0,0 +1,35 @@
#! /bin/sh
#
# 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 is a small program which will create directories n-levels deep.
# You just call it with something like:
#
# mkdirs /tmp/foo/bar/baz
#
# and it will create all the directories from /tmp down to baz which
# don't exist.
#
chmodprog="${CHMODPROG-chmod}"
mkdirprog="${MKDIRPROG-mkdir}"
make_dir () {
if test ! -d $1; then
make_dir `echo $1 | sed -e 's#/[^/]*$##'`
$mkdirprog $1
$chmodprog 755 $1
fi
}
make_dir `echo $1 | sed -e 's#/$##'`

101
hdf5_1_8_10/bin/mkinstalldirs Executable file
View File

@@ -0,0 +1,101 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id$
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 3
# End:
# mkinstalldirs ends here

45
hdf5_1_8_10/bin/newer Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
#
# 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.
#
# Compare the modification time of file argument 1 against other file arguments.
# Return true (0) if argument 1 is newer than all others, otherwise return
# false (1). If any of the argument is not a file, return false (1).
#
# Programmer: Albert Cheng
# Created Date: 2005/07/06
# Modification:
# Albert Cheng 2005/8/30
# Changed from two arguments to mulitple arguments.
if test $# -lt 2; then
exit 1
fi
if test ! -f $1; then
exit 1
fi
f1=$1
shift
for f in $*; do
if test ! -f $f; then
exit 1
fi
if test X = X`find $f1 -newer $f -print`; then
exit 1
fi
done
# passed all tests. Must be a file newer than all others.
exit 0

View 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
}

143
hdf5_1_8_10/bin/reconfigure Executable file
View File

@@ -0,0 +1,143 @@
#! /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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
# access to either file, you may request a copy from help@hdfgroup.org.
#
# A script to reconfigure autotools for HDF5, and to recreate other
# generated files specifc to HDF5.
# If the paths of the autotools are not specified by the user, they
# are hardcoded to point to their locations on HDF5 Linux machines.
# Users can specify the locations of the autotools with the following
# variables:
# AUTOCONF, AUTOMAKE, ACLOCAL, AUTOHEADER should be the path to the
# corresponding tools.
# LIBTOOL_DIR should be the path to the base libtool directory;
# $LIBTOOL_DIR/bin/libtool should invoke libtool, while
# $LIBTOOL_DIR/share/aclocal needs to be included by aclocal.
# Be very careful when specifying these tools manually! There are a lot
# 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.69"
AUTOMAKE_VERSION="automake (GNU automake) 1.12.3"
AUTOHEADER_VERSION="autoheader (GNU Autoconf) 2.69"
ACLOCAL_VERSION="aclocal (GNU automake) 1.12.3"
LIBTOOL_VERSION="(GNU libtool) 2.4.2"
M4_VERSION="m4 (GNU M4) 1.4.16"
#
# 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 jam in /mnt/hdf/packages and set paths accordingly.
if test -z ${AUTOCONF}; then
AUTOCONF=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoconf
fi
if test -z ${AUTOMAKE}; then
AUTOMAKE=/mnt/hdf/packages/automake/automake-1.12.3/bin/automake-1.12
fi
if test -z ${AUTOHEADER}; then
AUTOHEADER=/mnt/hdf/packages/autoconf/autoconf-2.69/bin/autoheader
fi
if test -z ${ACLOCAL}; then
ACLOCAL=/mnt/hdf/packages/automake/automake-1.12.3/bin/aclocal-1.12
fi
if test -z ${LIBTOOL}; then
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.16/bin/m4
fi
# Check version numbers of all autotools against the "correct" versions
AC_VERS=`${AUTOCONF} --version 2>&1 | grep "^${AUTOCONF_VERSION}"`
if test -z "${AC_VERS}"; then
echo "${AUTOCONF} version is not ${AUTOCONF_VERSION}"
exit 1
fi
AM_VERS=`${AUTOMAKE} --version 2>&1 | grep "^${AUTOMAKE_VERSION}"`
if test -z "${AM_VERS}"; then
echo "${AUTOMAKE} version is not ${AUTOMAKE_VERSION}"
exit 1
fi
AH_VERS=`${AUTOHEADER} --version 2>&1 | grep "^${AUTOHEADER_VERSION}"`
if test -z "${AH_VERS}"; then
echo "${AUTOHEADER} version is not ${AUTOHEADER_VERSION}"
exit 1
fi
AL_VERS=`${ACLOCAL} --version 2>&1 | grep "^${ACLOCAL_VERSION}"`
if test -z "${AL_VERS}"; then
echo "${ACLOCAL} version is not ${ACLOCAL_VERSION}"
exit 1
fi
LT_VERS=`${LIBTOOL} --version 2>&1 | grep "${LIBTOOL_VERSION}"`
if test -z "${LT_VERS}"; then
echo "${LIBTOOL} version is not ${LIBTOOL_VERSION}"
exit 1
fi
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}`
M4_DIR=`dirname ${M4}`
PATH=${AUTOCONF_DIR}:${M4_DIR}:$PATH
# Run autoconf/automake commands in order
echo ${ACLOCAL} -I ${LIBTOOL_DIR}/../share/aclocal
${ACLOCAL} -I ${LIBTOOL_DIR}/../share/aclocal || exit 1
echo ${AUTOHEADER}
${AUTOHEADER} || exit 1
echo ${AUTOMAKE} --add-missing
${AUTOMAKE} --add-missing || exit 1
echo ${AUTOCONF}
${AUTOCONF} || exit 1
# Clean up top-level Makefile.in
# pmake wants an argument to be the first non-comment line it encounters
# in the Makefile. Automake wants to reorganize the Makefile.
# To work around this, we post-process the top-level Makefile.in.
sed "s/^#xxx//" Makefile.in > Makefile.in.new
mv Makefile.in.new Makefile.in
# Run trace script
# The trace script adds H5TRACE macros to library source files. It should
# have no effect on files that don't have HDF5 API macros in them.
echo
echo " Running trace script:"
bin/trace src/H5*.c || exit 1
# Run make_err
# make_err automatically generates the H5E headers that create error message
# types for HDF5.
echo
echo " Running error generation script:"
bin/make_err src/H5err.txt || exit 1
# Run make_vers
# make_vers automatically generates the public headers that define the API version
# macros for HDF5.
echo
echo " Running API version generation script:"
bin/make_vers src/H5vers.txt || exit 1
exit 0

293
hdf5_1_8_10/bin/release Executable file
View File

@@ -0,0 +1,293 @@
#!/bin/sh
#
# 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.
#
# Make a release of hdf5.
#
# Programmer: Robb Matzke
# Creation date: on or before 1998-01-29.
#
# Modifications
# Robb Matzke, 1999-07-16
# The SunOS 5.6 sed *must* have slashes as delimiters. I changed things like
# `sed s+/CVS++' to `sed 's/\/CVS//'
#
# 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
#
# Print Usage page
USAGE()
{
cat << EOF
Usage: $0 [--nocheck] [-d <dir>] [-h] <methods> ...
-d DIR The name of the directory where the releas(es) should be
placed. By default, the directory is ./releases
--docver BRANCHNAME This is added for 1.8 and beyond to get the correct
version of documentation files from the hdf5docs
repository. BRANCHNAME for v1.8 should be hdf5_1_8.
--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
/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
EOF
}
# 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
echo "$0 must be run at the top level of the hdf5 source directory"
exit 1
fi
# Defaults
DEST=releases
VERS=`perl bin/h5vers`
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
DOC_URL=http://svn.hdfgroup.uiuc.edu/hdf5doc/trunk
CPPLUS_RM_NAME=cpplus_RM
# Restore previous Version information
RESTORE_VERSION()
{
if [ X-${VERS_OLD} != X- ]; then
echo restoring version information back to $VERS_OLD
rm -f config/lt_vers.am
cp $tmpdir/lt_vers.am config/lt_vers.am
bin/h5vers -s $VERS_OLD
VERS_OLD=
fi
}
# Command-line arguments
while [ -n "$1" ]; do
arg=$1
shift
case "$arg" in
-d)
DEST=$1
shift
;;
--nocheck)
check=no
;;
-h)
USAGE
exit 0
;;
--private)
pmode=yes
;;
--docver)
DOCVERSION=$1
shift
;;
-*)
echo "Unknown switch: $arg" 1>&2
USAGE
exit 1
;;
*)
methods="$methods $arg"
;;
esac
done
# Default methods are tar and md5
if [ "X$methods" = "X" ]; then
methods="tar md5"
fi
# Create the temporay work directory.
if mkdir $tmpdir; then
echo "temporary work directory for release. "\
"Can be deleted after release completes." > $tmpdir/README
else
echo "Failed to mkdir tmpdir($tmpdir)"
exit 1
fi
# setup restoration in case of abort.
trap RESTORE_VERSION 0
if [ X$pmode = Xyes ]; then
VERS_OLD=$VERS
# Copy old version of config/lt_vers.am, since it's hard to
# "undo" changes to it.
cp config/lt_vers.am $tmpdir
# Set version information to m.n.r-of$today.
# (h5vers does not correctly handle just m.n.r-$today.)
VERS=`echo $VERS | sed -e s/-.*//`-of$today
echo Private release of $VERS
bin/h5vers -s $VERS
fi
# Store hdf5-$VERS ("hdf5-1.7.51", e.g.) to a variable to avoid typos
HDF5_VERS=hdf5-$VERS
test "$verbose" && echo "Releasing $HDF5_VERS to $DEST" 1>&2
if [ ! -d $DEST ]; then
echo " Destination directory $DEST does not exist" 1>&2
exit 1
fi
# Check the validity of the MANIFEST file.
bin/chkmanifest || fail=yes
if [ "X$fail" = "Xyes" ]; then
if [ $check = yes ]; then
exit 1
else
echo "Continuing anyway..."
fi
fi
# Create a manifest that contains only files for distribution.
MANIFEST=$tmpdir/H5_MANIFEST
grep '^\.' MANIFEST | grep -v _DO_NOT_DISTRIBUTE_ >$MANIFEST
# Prepare the source tree for a release.
ln -s `pwd` $tmpdir/$HDF5_VERS || exit 1
# 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 in
# line 1.
for f in README.txt release_docs/RELEASE.txt; do
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
done
# trunk is different than branches.
if [ "${DOCVERSION}" ]; then
DOC_URL=http://svn.hdfgroup.uiuc.edu/hdf5doc/branches/${DOCVERSION}
fi
# Create the tar file
test "$verbose" && echo " Running tar..." 1>&2
( \
cd $tmpdir; \
tar cf $HDF5_VERS.tar $HDF5_VERS/Makefile \
`sed 's/^\.\//hdf5-'$VERS'\//' $MANIFEST` || exit 1 \
)
# Compress
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
;;
gzip)
test "$verbose" && echo " Running gzip..." 1>&2
gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz
;;
bzip2)
test "$verbose" && echo " Running bzip2..." 1>&2
bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2
;;
md5)
test "$verbose" && echo " Creating checksum..." 1>&2
(cd $tmpdir; md5sum $HDF5_VERS.tar ) > $DEST/$HDF5_VERS.tar.md5
;;
doc)
if [ "${DOCVERSION}" = "" ]; then
DOCVERSION=trunk
fi
test "$verbose" && echo " Creating docs..." 1>&2
# Check out docs from svn repo
(cd $tmpdir; svn co $DOC_URL > /dev/null) || exit 1
# Create doxygen C++ RM
(cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1
# Replace version of C++ RM with just-created version
rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME
mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME
# Compress the docs and move them to the release area
mv $tmpdir/$DOCVERSION $tmpdir/${HDF5_VERS}_docs
(cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs)
mv $tmpdir/${HDF5_VERS}_docs.tar $DEST
;;
esac
done
# Copy the RELEASE.txt to the release area.
cp release_docs/RELEASE.txt $DEST/$HDF5_VERS-RELEASE.txt
# 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.
if [ X$pmode = Xyes ]; then
RESTORE_VERSION
trap 0
fi
# Remove temporary things
rm -rf $tmpdir
exit 0

940
hdf5_1_8_10/bin/runtest Executable file
View File

@@ -0,0 +1,940 @@
#! /bin/sh
#
# 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.
#
# run the hdf5/bin/snapshot
# Usage:
# runtest run the test for the local host
# runtest <hostname> run the test for <hostname>
# runtest -all run the test for all predefined hosts
#
# Assumptions in knowing where to find the right scripts to execute.
# 1. assume we are at the top level of the hdf5 source. So, bin/* are
# where the script files are.
# 2. after the cvs update is completed, we can go to the snapshot area
# hdf5 source tree and use the bin/* there.
# 3. Cannot use the snapshot area scripts from the beginning because
# for one, the current directory is renamed as previous right after
# a snapshot release; and for another, some scripts may be changed
# by the cvs update while it is being used.
# local setup
DEBUGMODE=""
test -n "$DEBUGMODE" && echo "******** DEBUGMODE is $DEBUGMODE ************"
WHEREAMI='pwd'
CMD=
# the name of this program
PROGNAME="bin/runtest $DEBUGMODE"
# Setup
HOSTNAME=`hostname | cut -f1 -d.` # no domain part
TODAY=`date +%m%d%a`
WEEKDAY=`date +%a`
H5VER= # default to current CVS version
H5VERSION= # default to current CVS version
n_test=0 # Number of tests ran
n_pass=0 # Number of tests passed
n_fail=0 # Number of tests failed
n_skip=0 # Number of tests skipped
# Default to do checkout (only once) and test, no release.
# Will run test only if there is significant differences from previous version.
# If srcdir is not used, don't launched multiple tests
SNAPSHOT="${DEBUGMODE:+echo }bin/snapshot"
SRCDIR="srcdir"
# Default standard Snaptest commands
SNAPCMD="$SRCDIR test clean"
# Default Standard snaptest command options
STANDARD_OPT=""
ENABLE_PARALLEL="--enable-parallel"
CONFIGNAME=$HOSTNAME # Name used in the SNAPTESTCFG file
# test host default as local host.
TESTHOST=""
#################################
# Function definitions
#################################
# Print messages to stdout
# Use this to show output heading to stdout
PRINT()
{
echo "$*"
}
# Show seconds since midnight.
# This is used to calculate seconds elapsed
SecOfDay()
{
set `date '+%H %M %S'`
t_sec=`expr $1 \* 3600 + $2 \* 60 + $3`
echo $t_sec
}
# Calculated the elapsed time (in seconds) between the first
# and second time. If second time is smaller than the first,
# we assume the clock has passed midnight and calculate appropriately.
ElapsedTime()
{
if [ $2 -lt $1 ]; then
t_sec=`expr 3600 \* 24 - $1 + $2`
else
t_sec=`expr $2 - $1`
fi
echo `expr $t_sec / 60`m `expr $t_sec % 60`s
}
# Report errors
# $1--an error message to be printed
REPORT_ERR()
{
ERRMSG=$1
# print it with a banner shifted right a bit
PRINT " *************************************"
PRINT " `date`"
PRINT " $ERRMSG"
PRINT " *************************************"
# report it in the FAILED-LOG file too
PRINT "$ERRMSG" >> $FAILEDLOG
}
#
# Report results of the last test done
REPORT_RESULT()
{
if [ $retcode -eq 0 ]; then
if [ $skiptest = yes ]; then
n_skip=`expr $n_skip + 1`
PRINT "SKIPPED ${HOSTNAME}: $TEST_TYPE" | tee -a $SKIPPEDLOG
else
n_pass=`expr $n_pass + 1`
PRINT "PASSED ${HOSTNAME}: $TEST_TYPE" | tee -a $PASSEDLOG
fi
else
# test failed.
n_fail=`expr $n_fail + 1`
REPORT_ERR "****FAILED ${HOSTNAME}: $TEST_TYPE****"
fi
}
# Print a blank line
PRINT_BLANK()
{
PRINT
}
# Print test trailer
PRINT_TEST_TRAILER()
{
PRINT "*** finished $TEST_TYPE tests for $HOSTNAME ***"
date; EndTime=`SecOfDay`
PRINT Total time = `ElapsedTime $StartTime $EndTime`
PRINT_BLANK
}
# Print trailer summary
PRINT_TRAILER()
{
PRINT "*** finished tests in $HOSTNAME ***"
date; TotalEndTime=`SecOfDay`
PRINT "${HOSTNAME}: Ran $n_test($n_pass/$n_fail/$n_skip) $runtest_type, Grand total test time = " \
"`ElapsedTime $TotalStartTime $TotalEndTime`" | tee -a $TIMELOG
PRINT_BLANK
}
# Figure out which remote command to use to reach a host.
# Try ssh first, then rsh since fewer machines support rsh exec.
# $1--hostname to reach.
CHECK_RSH()
{
# Figure out how to use ping command in this host.
# Some hosts use "ping host count", some use "ping -c count host".
# Test "ping -c 3 -w 5" since it has timeout feature.
# Test "ping -c ..." style before "ping host 3" because some machines
# that recognize -c treat 'ping localhost 3' as to ping host '3'.
if [ -z "$PING" ]; then
if ping -c 3 -w 5 localhost >/dev/null 2>&1; then
PING='ping -c 3 -w 5'
PINGCOUNT=
elif ping -c 3 localhost >/dev/null 2>&1; then
PING='ping -c 3'
PINGCOUNT=
elif ping localhost 3 >/dev/null 2>&1; then
PING=ping
PINGCOUNT=3
else # don't know how to use ping.
PING=no_ping
PINGCOUNT=
fi
fi
#
host=$1
# Try remote command with host if it responds to ping.
# Still try it if we don't know how to do ping.
if [ no_ping = "$PING" ] || $PING $host $PINGCOUNT >/dev/null 2>&1; then
if ssh $host -n hostname >/dev/null 2>&1; then
RSH=ssh
elif rsh $host -n hostname >/dev/null 2>&1; then
RSH=rsh
else
PRINT cannot remote command with $host
RSH="NoRemoteCommand"
fi
else
RSH="NotReachable"
fi
}
# Wait for a file for at most number of minutes
# $1--the file
# $2--number of minutes
# WAIT_STATUS set to:
# -1 if errors encountered
# 0 if file found within time limit
# 1 if file not found within time limit
WAITFOR()
{
wait_file=$1
nminutes=$2
if [ -z "$wait_file" -o ! "$nminutes" -ge 0 ]
then
PRINT "errors in argument of WAITFOR(): wait_file($1) or nminutes($2)"
WAIT_STATUS=-1
return
fi
while [ ! -f $wait_file ]; do
if [ $nminutes -gt 0 ]; then
PRINT "Wait For $wait_file to appear"
sleep 60 #sleep 1 minute
else
WAIT_STATUS=1
return
fi
nminutes=`expr $nminutes - 1`
done
WAIT_STATUS=0
return
}
# Wait till a file disappears for at most number of minutes.
# Useful to wait till a lock is removed by another process.
# $1--the file
# $2--number of minutes
# WAIT_STATUS set to:
# -1 if errors encountered
# 0 if file disappears within time limit
# 1 if file has not disappeared within time limit
WAITTILL()
{
wait_file=$1
nminutes=$2
if [ -z "$wait_file" -o ! "$nminutes" -ge 0 ]
then
PRINT "errors in argument of WAITTILL(): wait_file($1) or nminutes($2)"
WAIT_STATUS=-1
return
fi
while [ -f $wait_file ]; do
if [ $nminutes -gt 0 ]; then
PRINT "Wait till $wait_file has disappeared"
sleep 60 #sleep 1 minute
else
WAIT_STATUS=1
return
fi
nminutes=`expr $nminutes - 1`
done
WAIT_STATUS=0
return
}
# Run one snapshot test
# $*--Types of test being run
RUNSNAPTEST()
{
SNAPCMD_OPT="$STANDARD_OPT" # snapshot test option
SRCDIRNAME=${HOSTNAME}
# restore CC, PATH in case they were changed in the last test.
CC="$CC_SAVED"
PATH=$PATH_SAVED
export PATH # DEC OSF1 needs to export PATH explicitly
TEST_TYPE=$*
retcode=0
skiptest=no
date
PRINT "*** starting $TEST_TYPE tests in $HOSTNAME ***"
PRINT "Uname -a: `uname -a`"
# Parse the test type and set options accordingly.
# See comments of SNAPTEST_CONFIG_PARSE().
while [ $# -gt 0 ]; do
case $1 in
-n32) # want -n32 option
SRCDIRNAME=${SRCDIRNAME}-n32
CC="cc -n32"
export CC
;;
-64) # want -64 option
SRCDIRNAME=${SRCDIRNAME}-64
CC="cc -64"
export CC
;;
parallel) # want parallel test
SNAPCMD_OPT="$SNAPCMD_OPT $ENABLE_PARALLEL"
SRCDIRNAME=${SRCDIRNAME}-pp
;;
standard) # standard test
;;
--*)
# option for configure
SNAPCMD_OPT="$SNAPCMD_OPT $1"
;;
op-configure)
# option for configure
SNAPCMD_OPT="$SNAPCMD_OPT $1 $2"
shift
;;
op-snapshot)
# option for snapshot
shift
SNAPCMD_OPT="$SNAPCMD_OPT $1"
;;
setenv)
# pass them along to snapshot set environment variable
shift
SNAPCMD_OPT="$SNAPCMD_OPT setenv $1 $2"
shift
;;
setenvN)
# set environment variable with $1 values
# e.g., setenvN 3 x a b c is same as setenv x="a b c".
# pass them along to snapshot set environment variable
shift
envN=$1
shift
envname=$1
SNAPCMD_OPT="$SNAPCMD_OPT setenvN $envN $envname"
envalue=
while test $envN -gt 0; do
shift
envalue="$envalue $1"
envN=`expr $envN - 1`
done
SNAPCMD_OPT="$SNAPCMD_OPT $envalue"
;;
skip)
# skip this test
skiptest=yes
;;
srcdirname)
# Use this before using parallel and -n32 since this overrides
# the others.
shift
SRCDIRNAME=$1
;;
deploy)
# deploy the built binary.
shift
SNAPCMD_OPT="$SNAPCMD_OPT deploy $1"
;;
deploydir)
# default directory for deployment.
shift
SNAPCMD_OPT="$SNAPCMD_OPT deploydir $1"
;;
*) # unknown test
PRINT "$0: unknown type of test ($1)"
retcode=1
;;
esac
shift
done
if [ $retcode -ne 0 -o $skiptest = yes ]; then
errcode=$retcode
return $retcode
fi
# Track down the zlib software
ans=`$SNAPYARD/current/bin/locate_sw zlib`
if [ $? = 0 ]; then
Z_INC=`echo $ans | cut -f1 -d,`
Z_LIB=`echo $ans | cut -f2 -d,`
SNAPCMD_OPT="$SNAPCMD_OPT zlib $Z_INC,$Z_LIB"
else
# cannot locate zlib software.
# continue the test, maybe configure can find it.
:
fi
if [ -n "${SRCDIRNAME}" ]; then
SNAPCMD_OPT="$SNAPCMD_OPT srcdirname ${SRCDIRNAME}"
fi
# Setup log file name to save test output
THIS_MINUTE=`date +%H%M`
LOGFILE=${LOGBASENAME}/${SRCDIRNAME}_${TODAY}_${THIS_MINUTE}
PRINT "Running snapshot with output saved in"
PRINT " $LOGFILE"
(date; PRINT Hostname=$HOSTNAME) >> $LOGFILE
(
cd $SNAPYARD/current
$SNAPSHOT $SNAPCMD $SNAPCMD_OPT
) >> $LOGFILE 2>&1
retcode=$?
[ $retcode -ne 0 ] && errcode=$retcode
date >> $LOGFILE
if [ $retcode -ne 0 ]; then
# Dump the first 10 lines and the last 30 lines of the LOGFILE.
( ntail=30
echo =========================
echo "Dumping logfile of ${HOSTNAME}: $TEST_TYPE"
echo "Last $ntail lines of $LOGFILE"
echo =========================
tail -$ntail $LOGFILE
echo =========================
echo Dumping done
echo =========================
echo ""
) >> $FAILEDDETAIL
fi
}
# configuration parsing.
# Taking configuration from input.
# This should be invoke with configure file as stdin.
# Syntax of the configure file:
# All lines started with the # are comment lines and are ignored.
# Blank lines are ignored too.
# Each config line starts with a "Scope" followed by test types.
#
# Scope can be:
# standard ... # what the standard test types are.
# <host>: <test> Do <test> for <host>
# all: <test> Do <test> for all hosts.
# <weekday>/... Use this scope if the <weekday> matches.
# <weekday> can be {Mon,Tue,Wed,Thu,Fri,Sat,Sun}
# If no <host>: input for a <host>, the standard test is used.
#
# Test types:
# standard tests defined in standard scope.
# -n32 -n32 mode. Apply to 64/32 bit OS such as IRIX64.
# parallel parallel mode.
# op-configure <option> configure option
# op-snapshot <option> snapshot option
# --* configure option
# setenv <name> <value> set environment variable <name> to <value>
# Pass along to snapshot
# setenvN <N> <name> <value> ...
# set environment variable with <N> values
# e.g., setenvN 3 x a b c is same as setenv x="a b c".
# Pass along to snapshot.
# skip skip this test
# srcdirname <name> use <name> as the build-directory.
# deploy <name> deploy the built binary at directory <name>.
# deploydir <name> use <name> as the default directory for deployment.
SNAPTEST_CONFIG_PARSE()
{
while read x y ; do
# Scan for entry for this weekday.
xd=`echo $x | cut -f1 -d/`
if [ "$xd" = ${WEEKDAY} ]; then
# strip away the weekday/ part.
x=`echo $x | cut -f2 -d/`
fi
case "$x" in
'' | '#'*)
# blank or comment lines. Continue.
;;
???/*)
# Ignore any entry not of this weekday.
;;
standard)
#standard configuration
STANDARD_OPT="$y"
;;
all: | ${CONFIGNAME}:)
# types of test for all hosts or this host
if [ -n "$TEST_TYPES" ]; then
TEST_TYPES="$TEST_TYPES ; $y"
else
TEST_TYPES="$y"
fi
;;
*:) # ignore types of test for other hosts
;;
*) # unknown configuration option
PRINT $x $y
PRINT "***Unknown configuration option. Ignored.***"
;;
esac
done
}
# Snap Test configuration parsing.
# If TEST_TYPES is not set, set it to do the "standard" test.
SNAPTEST_CONFIG()
{
TEST_TYPES=
STANDARD_OPT=
if [ -f $SNAPTESTCFG ]; then
SNAPTEST_CONFIG_PARSE < $SNAPTESTCFG
fi
TEST_TYPES=${TEST_TYPES:-'standard'}
}
# Show usage page
USAGE()
{
cat <<EOF
Usage: runtest [-h] [-debug] [-r<version>] [-all] [-nocvs] [-nodiff] [<host> ...]
-h
print this help page
-debug
turn on debug mode
-r<version>
do runtest for <version>
-all
launch tests for all pre-defined testing hosts
-nocvs
do not do cvs commands
-nodiff
do not do diff commands
-setup
setup the directory structure for snapshot test
-configname <name>
use <name> as hostname in the parsing of the snaptest configure file
<host>
launch tests for <host>
-all and <host> are contradictory and whichever is specified last, is
the one to take effect. If neither are given, do the test for the
local host.
EOF
}
# Verify if directory ($1) exists. If not, create it.
CHECK_DIR()
{
dir=$1
if test ! -e $1; then
echo mkdir $1
mkdir $1
errcode=$?
elif test ! -d $1; then
echo $1 is not a directory
errcode=1
fi
}
#################################
# Main
#################################
#################################
# Set up global variables
#################################
retcode=0 # error code of individula task
errcode=0 # error code of the whole test
skiptest=no # if test is skipped
CC_SAVED="$CC" # CC & PATH maybe changed within a test.
PATH_SAVED=$PATH # These save the original values.
timelimit=300 # time limit (minutes) for the timekeeper
#################################
# Parse options
#################################
while [ $# -gt 0 ]; do
case "$1" in
-h) # help--show usage
USAGE
exit 0
;;
-debug*)
# set debug mode
DEBUGMODE="$1"
SNAPSHOT="echo bin/snapshot"
PROGNAME="$PROGNAME $DEBUGMODE"
PRINT "******** DEBUGMODE is $DEBUGMODE ************"
;;
-r*)
# version string
H5VER="$1"
;;
-all)
# Test all hosts.
TESTHOST=-all
;;
-nocvs)
# do not do cvs commands.
NOCVS=nocvs
;;
-nodiff)
# do not do diff commands.
NODIFF=nodiff
;;
-configname)
# use <name> as hostname in the parsing of the snaptest configure file.
shift
CONFIGNAME=$1
;;
-setup)
# setup the directory structure for snapshot test.
CMD=setup
;;
-*) # Unknow option
PRINT "Unknown option ($1)"
USAGE
exit 1
;;
*)
TESTHOST=$*
break
;;
esac
shift
done
# setup H5VER if not set yet
if [ -z "$H5VER" -a -f bin/snapshot_version ]
then
. bin/snapshot_version
fi
if [ -n "$H5VER" ]
then
H5VERSION=hdf5_`echo $H5VER | sed -e s/-r// -e s/\\\./_/g`
PROGNAME="$PROGNAME $H5VER"
else
H5VERSION=hdf5
fi
#################################
# Setup snapshot test directories
#################################
BASEDIR=${HOME}/snapshots-${H5VERSION}
# initial processing of setup option if requested
if test x-$CMD = x-setup; then
CHECK_DIR $BASEDIR
test $errcode -ne 0 && exit 1
elif [ ! -d ${BASEDIR} ]; then
echo "BASEDIR ($BASEDIR) does not exist"
exit 1
fi
# Show the real physical path rather than the symbolic path
SNAPYARD=`cd $BASEDIR && /bin/pwd`
# Log file basename
LOGDIR=${SNAPYARD}/log
LOGBASENAME=${LOGDIR}
PASSEDLOG=${LOGDIR}/PASSED_LOG_${TODAY}
FAILEDLOG=${LOGDIR}/FAILED_LOG_${TODAY}
FAILEDDETAIL=${LOGDIR}/FAILED_DETAIL_${TODAY}
SKIPPEDLOG=${LOGDIR}/SKIPPED_LOG_${TODAY}
TIMELOG=${LOGDIR}/TIME_LOG_${TODAY}
TIMEKEEPERLOG=${LOGDIR}/TIMEKEEPER_LOG_${TODAY}
CVSLOG=${LOGDIR}/CVS_LOG_${TODAY}
CVSLOG_LOCK=${LOGDIR}/CVS_LOG_LOCK_${TODAY}
DIFFLOG=${LOGDIR}/DIFF_LOG_${TODAY}
COPYRIGHT_ERR=${LOGDIR}/COPYRIGHT_ERR_${TODAY}
# Snap Test hosts and Configuration files
ALLHOSTSFILE=${SNAPYARD}/allhostfile
SNAPTESTCFG=${SNAPYARD}/snaptest.cfg
TIMELIMIT=${SNAPYARD}/timelimit
TMPFILE="${LOGDIR}/#runtest.${TODAY}.$$"
# more processing of setup option if requested
if test x-$CMD = x-setup; then
CHECK_DIR $LOGDIR
test $errcode -ne 0 && exit 1
CHECK_DIR $LOGDIR/OLD
test $errcode -ne 0 && exit 1
CHECK_DIR $SNAPYARD/TestDir
test $errcode -ne 0 && exit 1
# create empty test hosts or configure files if non-existing
for f in $ALLHOSTSFILE $SNAPTESTCFG; do
if test ! -f $f; then
echo Creating $f
touch $f
fi
done
# create or update the current source.
echo update current source
$SNAPSHOT checkout
# setup completed. Exit.
exit 0
fi
#################################
# Show some host status numbers
#################################
# df sometimes hangs due to file system problems. Invoke it as background
# process and give it 10 seconds to finish. If it hangs, just continue.
uptime
df &
sleep 10
#################################
# Setup test host(s)
#################################
if [ "$TESTHOST" = -all ]; then
if [ -f $ALLHOSTSFILE ]; then
TESTHOST=`sed -e '/^#/d;/^ *$/d' $ALLHOSTSFILE`
else
PRINT "could not access the all-hosts-file ($ALLHOSTSFILE)"
USAGE
exit 1
fi
fi
#################################
# Setup to print a trailer summary when exiting not via
# the normal end of the script.
#################################
trap PRINT_TRAILER 0
#
TotalStartTime=`SecOfDay`
# Process the configuration
SNAPTEST_CONFIG
PRINT STANDARD_OPT=$STANDARD_OPT
PRINT TEST_TYPES=$TEST_TYPES
PRINT_BLANK
# Do a checkout if one has not been done today.
# Then check MANIFEST file and copyrights noitces.
if [ -z "$NOCVS" ]; then
PRINT "Running CVS checkout with output saved in"
PRINT " $CVSLOG"
# Set CVS lock first
touch $CVSLOG_LOCK
($SNAPSHOT checkout ) >> $CVSLOG 2>&1
# Save error code and remove the lock
errcode=$?
rm -f $CVSLOG_LOCK
if [ $errcode -ne 0 ]; then
# test failed.
REPORT_ERR "****FAILED ${HOSTNAME}: CVS checkout****"
exit $errcode
fi
# ===================
# Check MANIFEST file
# ===================
PRINT Checking MAINFEST file ...
(cd $SNAPYARD/current; bin/chkmanifest) > $TMPFILE 2>&1
errcode=$?
if [ $errcode -eq 0 ]; then
# test passed.
cat $TMPFILE
else
# test failed.
REPORT_ERR "****FAILED ${HOSTNAME}: MANIFEST check****"
( echo =========================
echo "MANIFEST checking failed output"
echo =========================
cat $TMPFILE
echo =========================
echo "MANIFEST checking failed output done"
echo =========================
echo ""
) >> $FAILEDDETAIL
fi
rm $TMPFILE
PRINT_BLANK
# No copyright checking until what need copyright is decided. 2006/4/7.
if false; then
# ======================
# Check Copyright notice
# ======================
PRINT Checking Copyrights notices ...
if (cd $SNAPYARD/current; bin/chkcopyright) > $TMPFILE 2>&1 ; then
echo Passed.
else
# Save the output and report some of it.
# Do not report it as failed for runtest yet.
# Send a separate report mail via hardcoding.
# Need fixes/cleanup later.
echo "Failed. See detail in another report mail"
cp $TMPFILE $COPYRIGHT_ERR
nheadlines=300
ntaillines=5 # Number of lines in report summary.
(
echo =========================
echo "Copyright checking failed. Showing first $nheadlines lines of output."
echo "Complete output is in file $COPYRIGHT_ERR"
echo =========================
nreportlines=`wc -l < $COPYRIGHT_ERR`
if [ $nreportlines -le `expr $nheadlines + $ntaillines` ]; then
# Just print the whole file.
cat $COPYRIGHT_ERR
else
# Show the first $nheadlines plus report summary
head -$nheadlines $COPYRIGHT_ERR
echo ...
tail -$ntaillines $COPYRIGHT_ERR
fi
) | Mail -s "${H5VERSION} Copyrights check Failed" hdf5lib
fi
rm $TMPFILE
PRINT_BLANK
fi
else
# make sure the cvs update, if done by another host, has completed.
# First wait for the presence of $CVSLOG which signals some host
# has started the cvs update. Then wait for the absense of $CVSLOG_LOCK
# which signals the host has completed the cvs update.
WAITFOR $CVSLOG 90
if [ $WAIT_STATUS -ne 0 ]; then
errcode=$WAIT_STATUS
REPORT_ERR "****FAILED ${HOSTNAME}: Time expired waiting CVS update to start****"
exit $errcode
fi
WAITTILL $CVSLOG_LOCK 10
if [ $WAIT_STATUS -ne 0 ]; then
errcode=$WAIT_STATUS
REPORT_ERR "****FAILED ${HOSTNAME}: Time expired waiting CVS update to finish****"
exit $errcode
fi
fi
# run a snapshot diff to see if any significant differences between
# the current and previous versions
if [ -z "$NODIFF" ]; then
$SNAPSHOT diff >> $DIFFLOG 2>&1
errcode=$?
# check the errcode only if NOT in DEBUG MODE
if [ -z "$DEBUGMODE" -a $errcode -eq 0 ]; then
# no need to run test
PRINT "NO TEST: no significant differences between current and previous versions" |
tee -a $PASSEDLOG
exit 0
fi
fi
# we can use the version of script in SNAPYARD/current now.
# Don't do the diff or cvs update any more.
PROGNAME="$SNAPYARD/current/$PROGNAME -nodiff -nocvs"
# Decide to do test for the local host or for remote hosts
if [ -n "$TESTHOST" -a $HOSTNAME != "$TESTHOST" ]; then
date
PRINT "*** launching tests from $HOSTNAME ***"
PRINT_BLANK
TEST_TYPE="launching"
cd ${SNAPYARD}/log
# Fork off timekeeper if concurrent tests will be used.
if [ -n "$SRCDIR" ]; then
timelimit=`grep -v '^#' $TIMELIMIT`
($SNAPYARD/current/bin/timekeeper $timelimit > $TIMEKEEPERLOG 2>&1 &)
PRINT " Fork off timekeeper $timelimit"
fi
runtest_type="hosts"
for h in $TESTHOST; do
# Must do CONFIGNAME before $h got changed by the second cut.
# cut returns the whole string if there is no / in the string
# at all. But that works okay for the CONFIGNAME too.
CONFIGNAME=`echo $h | cut -f2 -d/`
h=`echo $h | cut -f1 -d/`
n_test=`expr $n_test + 1`
TMP_OUTPUT="#${h}_${CONFIGNAME}.out"
(PRINT "=============="
PRINT "Testing $h"
PRINT "==============") > $TMP_OUTPUT
CHECK_RSH $h
# run the remote shell command with output to $TMP_OUTPUT
case "$RSH" in
rsh|ssh)
CMD="$RSH $h -n $PROGNAME -configname $CONFIGNAME"
PRINT $CMD
# launch concurrent tests only if srcdir is used
if [ -n "$SRCDIR" ]; then
$CMD &
echo $! > PID.${h}_${CONFIGNAME}
else
$CMD
fi
;;
NoRemoteCommand)
PRINT $h does not accept Remote Command "(`date`)"
;;
NotReachable)
PRINT $h is not reachable "(`date`)"
;;
*)
PRINT "CHECK_RSH for $h returned unknow result ($RSH)"
;;
esac >> $TMP_OUTPUT 2>&1
done
# wait for all launched tests to finish, then cat them back out.
wait
# Pause a moment in case the timekeeper is terminating processes.
wait 30
for h in $TESTHOST; do
CONFIGNAME=`echo $h | cut -f2 -d/`
h=`echo $h | cut -f1 -d/`
TMP_OUTPUT="#${h}_${CONFIGNAME}.out"
cat $TMP_OUTPUT
# Verify test script did complete by checking the last lines
(tail -2 $TMP_OUTPUT | grep -s 'Grand total' > /dev/null 2>&1) ||
(REPORT_ERR "****FAILED ${h}: snaptest did not complete****" &&
PRINT_BLANK)
rm -f $TMP_OUTPUT PID.${h}_${CONFIGNAME}
done
exit 0
fi
# run the test(s)
# Note that first field is cut without -s but all subsequent cut
# must use -s. If -s is not used at all, a $TEST_TYPES that has
# no ';' (only 1 test), will pass through intact in all cut. That
# results in infinite looping.
# If -s is used with the first field, it will suppress completely
# a $TYPE_TYPES that has no ';' (only 1 tst ). That results in no
# test at all.
# Note that n_test must start as 1.
#
n_test=1
runtest_type="tests"
TEST="`echo $TEST_TYPES | cut -f$n_test -d';'`"
while [ -n "$TEST" ]; do
StartTime=`SecOfDay`
RUNSNAPTEST $TEST
REPORT_RESULT
PRINT_TEST_TRAILER
n_test=`expr $n_test + 1`
TEST="`echo $TEST_TYPES | cut -f$n_test -s -d';'`"
done
# dec n_test to show the actual number of tests ran.
n_test=`expr $n_test - 1`
PRINT_TRAILER
# disable trailer summary printing since all trailers have been
# printed and we are exiting normally.
trap 0
exit $errcode

516
hdf5_1_8_10/bin/snapshot Executable file
View File

@@ -0,0 +1,516 @@
#!/bin/sh
#
# 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 script should be run nightly from cron. It checks out hdf5
# from the source repository and compares it against the previous
# snapshot. If anything significant changed then a new snapshot is
# created, the minor version number is incremented, and the change is
# checked back into the source repository.
#
# function definitions
TIMESTAMP()
{
echo "=====" "$1": "`date`" "====="
}
EXIT_BANNER()
{
TIMESTAMP "Exit $PROGNAME with status=$?"
}
# Show current total disk usage.
DISKUSAGE()
{
du -ks | \
( read x y; echo "Disk Usage=$x KB" )
}
# MAIN
# SGI /bin/sh replaces $0 as function name if used in a function.
# Set the name here to avoid that ambiguity and better style too.
PROGNAME=$0
echo "====================================="
echo "$PROGNAME $*"
echo "====================================="
TIMESTAMP MAIN
uname -a
# setup exit banner message
trap EXIT_BANNER 0
# Dump environment variables before option parsing
echo ===Dumping environment variables before option parsing ===
printenv | sort
echo ===Done Dumping environment variables before option parsing ===
# snapshots release directory. Default relative to $BASEDIR.
ReleaseDir_default=release_dir
# Where is the zlib library?
# At NCSA, half of the machines have it in /usr/lib, the other half at
# /usr/ncsa/lib. Leave it unset.
ZLIB_default=
ZLIB=$ZLIB_default
# What compression methods to use? (md5 does checksum).
METHODS="gzip bzip2 md5 doc"
# Use User's MAKE if set. Else use generic make.
MAKE=${MAKE:-make}
# Default check action.
CHECKVAL=check
#
# Command options
cmd="all"
test_opt=""
errcode=0
while [ $# -gt 0 ] ; do
case "$1" in
all)
cmd="all"
;;
checkout)
cmdcheckout="checkout"
cmd=""
;;
diff)
cmddiff="diff"
cmd=""
;;
deploy)
# deploy the built binary.
shift
if [ $# -lt 1 ]; then
echo "deploy <dir> missing"
errcode=1
cmd="help"
break
fi
cmddeploy="deploy"
DEPLOYDIRNAME="$1"
;;
deploydir)
# default directory for deployment.
shift
if [ $# -lt 1 ]; then
echo "deploydir <dir> missing"
errcode=1
cmd="help"
break
fi
deploydir="$1"
;;
test)
cmdtest="test"
cmd=""
;;
setenv)
# set environment variable
shift
eval $1="$2"
export $1
shift
;;
setenvN)
# set environment variable with $1 values
# e.g., setenvN 3 x a b c is same as setenv x="a b c".
# a kludge now--the extra single quotes are needed
# else eval complains.
shift
envN=$1
shift
envname=$1
envalue=
while test $envN -gt 0; do
shift
envalue="$envalue $1"
envN=`expr $envN - 1`
done
eval $envname="'$envalue'"
export $envname
;;
srcdir)
#use srcdir option for test
srcdir="yes"
;;
srcdirname)
shift
if [ $# -lt 1 ]; then
echo "srcdirname <dir> missing"
errcode=1
cmd="help"
break
fi
SRCDIRNAME="$1"
;;
release)
cmdrel="release"
cmd=""
;;
clean | distclean)
cmdclean="$1"
cmd=""
;;
help)
cmd="help"
break
;;
echo)
set -x
break
;;
zlib)
shift
if [ $# -lt 1 ]; then
echo "ZLIB information missing"
errcode=1
cmd="help"
break
fi
ZLIB="$1"
;;
releasedir)
shift
if [ $# -lt 1 ]; then
echo "Release directory name missing"
errcode=1
cmd="help"
break
fi
ReleaseDir="$1"
;;
check-vfd)
CHECKVAL=check-vfd
;;
yodconfigure)
YODCONFIGURE=yes
;;
--*)
OP_CONFIGURE="$OP_CONFIGURE $1"
;;
op-configure)
shift
if [ $# -lt 1 ]; then
echo "op-configure option missing"
errcode=1
cmd="help"
break
fi
OP_CONFIGURE="$OP_CONFIGURE $1"
;;
*)
echo "Unkown option $1"
errcode=1
cmd="help"
break
;;
esac
shift
done
# Dump environment variables after option parsing
echo ===Dumping environment variables after option parsing ===
printenv | sort
echo ===Done Dumping environment variables after option parsing ===
if [ "$cmd" = help ]; then
set -
cat <<EOF
Usage: $PROGNAME [all] [checkout] [diff] [test] [srcdir] [release] [help]
[clean] [distclean] [echo] [deploy <dir>] [deploydir <dir>]
[zlib <zlib_path>] [releasedir <dir>] [srcdirname <dir>] [check-vfd]
[op-configure <option>] [--<option>]
all: Run all commands (checkout, test & release)
[Default is all]
checkout: Run source checkout
diff: Run diff on current and previous versions. Exit 0 if
no significant differences are found. Otherwise, non-zero.
deploy: deploy binary to directory <dir>
deploydir: use <dir> as the default directory for deployment
test: Run test
release: Run release
clean: Run make clean
distclean:Run make distclean
echo: Turn on echo mode (set -x)
setenv <name> <value>:
Set environment variable <name> to <value>.
setenvN <N> <name> <value> ...:
Set environment variable with <N> values.
E.g., setenvN 3 x a b c is same as setenv x="a b c".
srcdir: Use srcdir option (does not imply other commands)
"snapshot srcdir" is equivalent to "snapshot srcdir all"
"snapshot srcdir checkout" is equivalent to "snapshot checkout"
srcdirname <dir>:
Use <dir> as the srcdir testing directory if srcdir is choosen.
If <dir> starts with '-', it is append to the default name
E.g., "snapshot srcdir srcdirname -xx" uses hostname-xx
[Default is hostname]
help: Print this message
echo: Turn on shell echo
zlib <zlib_path>:
Use <zlib_path> as the ZLIB locations
[Default is $ZLIB_default]
releasedir <dir>:
Use <dir> as the release directory
[Default is $ReleaseDir_default]
check-vfd:
Run make check-vfd instead of just make check.
op-configure <option>:
Pass <option> to the configure command
E.g., "snapshot op-configure --enable-parallel"
configures for parallel mode
--<option>:
Pass --<option> to the configure command
E.g., "snapshot --enable-parallel"
configures for parallel mode
EOF
exit $errcode
fi
# Setup the proper configure option (--with-zlib) to use zlib library
# provide ZLIB is non-empty.
ZLIB=${ZLIB:+"--with-zlib="$ZLIB}
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
if [ -f bin/snapshot_version ]; then
. bin/snapshot_version
else
H5VERSION=hdf5
fi
BASEDIR=${HOME}/snapshots-${H5VERSION}
if [ ! -d ${BASEDIR} ]; then
echo "BASEDIR ($BASEDIR) does not exist"
exit 1
fi
CURRENT=${BASEDIR}/current
PREVIOUS=${BASEDIR}/previous
ReleaseDir=${ReleaseDir:=${BASEDIR}/${ReleaseDir_default}}
HOSTNAME=`hostname | cut -f1 -d.` # no domain part
if [ $H5VERSION != hdf5 ]; then
SVNVERSION="hdf5/branches/$H5VERSION"
else
SVNVERSION=hdf5/trunk # use the default (trunk) version
fi
# Try finding a version of diff that supports the -I option too.
DIFF=diff
for d in `echo $PATH | sed -e 's/:/ /g'` ; do
test -x $d/diff && $d/diff -I XYZ /dev/null /dev/null > /dev/null 2>&1 &&
DIFF=$d/diff && break
done
#=============================
# Run source checkout
#=============================
if [ "$cmd" = "all" -o -n "$cmdcheckout" ]; then
TIMESTAMP "checkout"
# If there is a Makefile in ${CURRENT}, the last test done in it
# has not been distclean'ed. They would interfere with other
# --srcdir build since make considers the files in ${CURRENT}
# take precedence over files in its own build-directory. Run
# a "make distclean" to clean them all out. This is not really
# part of the "checkout" functions but this is the most convenient
# spot to do the distclean. We will also continue the checkout process
# regardless of the return code of distclean.
( cd ${CURRENT}; test -f Makefile && ${MAKE} distclean)
SVNROOT=http://svn.hdfgroup.uiuc.edu
# Check out the current version from source repository.
(cd $BASEDIR; svn -q co ${SVNROOT}/${SVNVERSION} current ) || exit 1
fi # Do source checkout
#=============================
# Run Test the HDF5 library
#=============================
if [ "$cmd" = "all" -o -n "$cmdtest" -o -n "$cmddiff" ]; then
TIMESTAMP "diff"
# setup if srcdir is used.
if [ -z "$srcdir" ]; then
TESTDIR=${CURRENT}
else
#create TESTDIR if not exist yet
case "$SRCDIRNAME" in
"")
SRCDIRNAME=$HOSTNAME
;;
-*)
SRCDIRNAME="$HOSTNAME$SRCDIRNAME"
;;
esac
TESTDIR=${BASEDIR}/TestDir/${SRCDIRNAME}
test -d ${TESTDIR} || mkdir ${TESTDIR}
fi
# Make sure current version exists and is clean
if [ -d ${TESTDIR} ]; then
(cd ${TESTDIR} && ${MAKE} distclean)
else
errcode=$?
snapshot=no
exit $errcode
fi
# Compare it with the previous version. Compare only files listed in
# the MANIFEST plus the MANIFEST itself.
if [ -d ${PREVIOUS} ]; then
if (${DIFF} -c ${PREVIOUS}/MANIFEST ${CURRENT}/MANIFEST); then
snapshot=no
for src in `grep '^\.' ${CURRENT}/MANIFEST|expand|cut -f1 -d' '`; do
if ${DIFF} -I H5_VERS_RELEASE -I " released on " \
-I " currently under development" \
${PREVIOUS}/$src ${CURRENT}/$src
then
: #continue
else
snapshot=yes
break
fi
done
fi
fi
# if diff is choosen, exit 0 if no significant differences are found.
# otherwise, exit 1. This includes cases of other failures.
if [ -n "$cmddiff" ]; then
if [ $snapshot = no ]; then
exit 0
else
exit 1
fi
fi
# Build, run tests and install procedures
if [ "$snapshot" = "yes" ]; then
if (cd ${TESTDIR} && \
TIMESTAMP "configure" && \
${srcdir:+${CURRENT}/}${CONFIGURE} && \
TIMESTAMP "make" && \
${MAKE} && DISKUSAGE \
TIMESTAMP ${CHECKVAL} && \
${MAKE} ${CHECKVAL} && DISKUSAGE \
TIMESTAMP "install" && \
${MAKE} install-all && DISKUSAGE \
TIMESTAMP "check-install" && \
${MAKE} check-install && DISKUSAGE \
TIMESTAMP "uninstall" && \
${MAKE} uninstall-all && DISKUSAGE); then
:
else
errcode=$?
snapshot=no
exit $errcode
fi
fi
fi # Test the HDF5 library
#=============================
# Run deployment if requested.
#=============================
if [ -n "$DEPLOYDIRNAME" ]; then
if [ "$snapshot" = "yes" ]; then
TIMESTAMP "deploy"
if (cd ${TESTDIR} &&
${CURRENT}/bin/deploy ${deploydir}/${DEPLOYDIRNAME} && \
TIMESTAMP "clean" && \
${MAKE} clean && \
TIMESTAMP "check-install prefix=${deploydir}/${DEPLOYDIRNAME}" && \
${MAKE} check-install prefix=${deploydir}/${DEPLOYDIRNAME}); then
: #continue
else
errcode=$?
exit $errcode
fi
fi
fi # Deploy
#=============================
# Run Release snapshot, update version, and commit to source repository
#=============================
if [ "$cmd" = "all" -o -n "$cmdrel" ]; then
if [ "$snapshot" = "yes" ]; then
TIMESTAMP "release"
(cd ${CURRENT} && ${MAKE} distclean)
(
# Turn on exit on error in the sub-shell so that it does not
# commit source if errors encounter here.
set -e
cd ${CURRENT}
RELEASE_VERSION="`perl bin/h5vers -v`"
echo "Making snapshot release ($RELEASE_VERSION) to ${ReleaseDir}..."
bin/release -d $ReleaseDir $METHODS
perl bin/h5vers -i
svn -q commit -m "Snapshot $RELEASE_VERSION"
)
errcode=$?
fi
# Replace the previous version with the current version.
# Should check if the errcode of the release process but there
# are other failures after release was done (e.g. h5vers or svn failures)
# that should allow the replacement to occure.
rm -rf ${PREVIOUS}
mv ${CURRENT} ${PREVIOUS}
fi #Release snapshot
#=============================
# Clean the test area. Default is no clean.
#=============================
if [ -n "$cmdclean" ]; then
TIMESTAMP "clean"
# setup if srcdir is used.
if [ -z "$srcdir" ]; then
TESTDIR=${CURRENT}
else
case "$SRCDIRNAME" in
"")
SRCDIRNAME=$HOSTNAME
;;
-*)
SRCDIRNAME="$HOSTNAME$SRCDIRNAME"
;;
esac
TESTDIR=${BASEDIR}/TestDir/${SRCDIRNAME}
fi
# clean it
if (cd ${TESTDIR} && ${MAKE} $cmdclean ) then
:
else
errcode=$?
snapshot=no
exit $errcode
fi
fi # Clean the Test directory
exit $errcode

View File

@@ -0,0 +1,23 @@
#
# 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.
#
# default version for snapshot test
# H5VERSION matches with a source version symbolic name. Will test use the
# latest revision of that branch. If set to "hdf5", it uses the main
# version.
# H5VER tells runtest which version to run
H5VERSION=hdf5_1_8_10
H5VER="-r1.8.10"

131
hdf5_1_8_10/bin/timekeeper Executable file
View File

@@ -0,0 +1,131 @@
#!/bin/sh
##
# 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.
##
# As a time keeper of the remote daily test process launched by runtest.
# It sleeps for a certain time and then wakes up to hangup those processes
# that are still around, assuming they have run too long.
#
# Programmer: Albert Cheng
# Created Date: 2004/12/23
# variable initialization
waitminutes=300 # default to 5 hours == 300 minutes
debugtimelimit=
debugflag= # no debug
# Function definitions
#
# PRINTMSG
# Print a one line message left justified in a field of 70 characters
# without newline. More output for this line later.
#
PRINTMSG() {
SPACES=" "
echo "$* $SPACES" | cut -c1-70 | tr -d '\012'
}
USAGE()
{
echo "Usage: %0 [-h] [-debug] [<time-limit>]"
echo " Run timekeeper with <time-limit> minutes, default is $waitminutes."
echo " If <time-limit> is in the form of HH:MM, it means wait till then."
echo " -h print this help page"
echo " -debug run debug mode"
}
ParseOption()
{
if [ $# -gt 0 -a "$1" = -h ]; then
shift
USAGE
exit 0
fi
if [ $# -gt 0 -a "$1" = -debug ]; then
shift
debugflag=yes
waitminutes=1 # use shorter time for debug
fi
if [ $# -gt 0 ]; then
targettime=$1
shift
# find out it is minutes to wait or HH:MM to wake up
case $targettime in
*:*) # HH:MM
currenttime=`date +%H:%M`
currenthour=`echo $currenttime | cut -f1 -d:`
currentminute=`echo $currenttime | cut -f2 -d:`
targethour=`echo $targettime | cut -f1 -d:`
targetminute=`echo $targettime | cut -f2 -d:`
waitminutes=`expr \( $targethour - $currenthour \) \* 60 + $targetminute - $currentminute`
if test $waitminutes -le 0; then
# target time is in tomorrow, add 1 day of minutes
waitminutes=`expr 24 \* 60 + $waitminutes`
fi
;;
*)
waitminutes=$targettime
;;
esac
fi
}
# Main body
echo "Timekeeper started at `date`"
ParseOption $*
waitperiod=`expr $waitminutes \* 60` # convert to seconds
if [ -z "$debugflag" ]; then
# normal time keeping mode
# sleep first
echo Timekeeper sleeping for $waitperiod seconds
sleep $waitperiod
# Look for any processes still around
echo "Timekeeper woke up at `date`, looking for processes to terminate..."
for x in PID.* ; do
if [ -f $x ]; then
pid=`cat $x`
# check if process is still around
if test X$pid \!= X && ps -p $pid > /dev/null; then
echo "terminating process $x ($pid)"
kill -HUP $pid
echo "Remote shell command ended. But some processes might still be"
echo "running in the remote machine. Login there to verify."
fi
fi
done
else
# Debug mode. Launch two rsh process, one ends before, the other after
# waitperiod. Must launch timekeeper from a subshell, else the debug
# will wait for it too.
myhostname=`hostname`
( $0 $waitminutes &)
debugtimelimit=`expr $waitperiod - 10`
echo rsh $myhostname sleep $debugtimelimit
rsh $myhostname sleep $debugtimelimit &
echo $! > PID.before
debugtimelimit=`expr $waitperiod + 10`
echo rsh $myhostname sleep $debugtimelimit
rsh $myhostname sleep $debugtimelimit &
echo $! > PID.after
wait
rm PID.before PID.after
fi
echo "Timekeeper ended at `date`"

329
hdf5_1_8_10/bin/trace Executable file
View File

@@ -0,0 +1,329 @@
#!/usr/bin/perl -w
##
# 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.
##
require 5.003;
$Source = "";
##############################################################################
# A map from type name to type letter. We use this map for two reasons:
# 1. We want the debugging stuff in the source code to be as unobtrusive as
# possible, which means as compact as possible.
# 2. It's easier (faster) to parse these one and two-letter types in the C
# functions that display debugging results.
#
# All type strings are one or two characters. One-character strings
# are always lower case and should be used for common types.
# Two-character strings begin with an upper-case letter which is
# usually the same as the package name.
#
%TypeString = ("haddr_t" => "a",
"hbool_t" => "b",
"double" => "d",
"H5D_alloc_time_t" => "Da",
"H5FD_mpio_collective_opt_t" => "Dc",
"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",
"H5E_direction_t" => "Ed",
"H5E_error_t" => "Ee",
"H5E_type_t" => "Et",
"H5F_close_degree_t" => "Fd",
"H5F_scope_t" => "Fs",
"H5F_libver_t" => "Fv",
"H5G_obj_t" => "Go",
"H5G_stat_t" => "Gs",
"hsize_t" => "h",
"hssize_t" => "Hs",
"H5E_major_t" => "i",
"H5E_minor_t" => "i",
"H5_iter_order_t" => "Io",
"H5_index_t" => "Ii",
"hid_t" => "i",
"int" => "Is",
"int32_t" => "Is",
"unsigned" => "Iu",
"unsigned int" => "Iu",
"H5I_type_t" => "It",
"H5G_link_t" => "Ll", #Same as H5L_type_t now
"H5L_type_t" => "Ll",
"MPI_Comm" => "Mc",
"MPI_Info" => "Mi",
"H5FD_mem_t" => "Mt",
"off_t" => "o",
"H5O_type_t" => "Ot",
"H5P_class_t" => "p",
"hobj_ref_t" => "r",
"H5R_type_t" => "Rt",
"char" => "s",
"H5S_class_t" => "Sc",
"H5S_seloper_t" => "Ss",
"H5S_sel_type" => "St",
"htri_t" => "t",
"H5T_cset_t", => "Tc",
"H5T_direction_t", => "Td",
"H5T_norm_t" => "Tn",
"H5T_order_t" => "To",
"H5T_pad_t" => "Tp",
"H5T_pers_t" => "Te",
"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",
"H5A_operator1_t" => "x",
"H5A_operator2_t" => "x",
"H5A_info_t" => "x",
"H5AC_cache_config_t" => "x",
"H5D_operator_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",
"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",
"H5I_free_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",
"H5P_iterate_t" => "x",
"H5P_prp_create_func_t" => "x",
"H5P_prp_copy_func_t" => "x",
"H5P_prp_close_func_t" => "x",
"H5P_prp_delete_func_t" => "x",
"H5P_prp_get_func_t" => "x",
"H5P_prp_set_func_t" => "x",
"H5P_prp_compare_func_t" => "x",
"H5T_cdata_t" => "x",
"H5T_conv_t" => "x",
"H5T_conv_except_func_t" => "x",
"H5Z_func_t" => "x",
"H5Z_filter_func_t" => "x",
"size_t" => "z",
"H5Z_SO_scale_type_t" => "Za",
"H5Z_class_t" => "Zc",
"H5Z_EDC_t" => "Ze",
"H5Z_filter_t" => "Zf",
"ssize_t" => "Zs",
);
##############################################################################
# Print an error message.
#
sub errmesg ($$@) {
my ($file, $func, @mesg) = @_;
my ($mesg) = join "", @mesg;
my ($lineno) = 1;
if ($Source =~ /(.*?\n)($func)/s) {
local $_ = $1;
$lineno = tr/\n/\n/;
}
print "$file: in function \`$func\':\n";
print "$file:$lineno: $mesg\n";
}
##############################################################################
# Given a C data type return the type string that goes with it.
#
sub argstring ($$$) {
my ($file, $func, $atype) = @_;
my ($ptr, $tstr, $array) = (0, "!", "");
my ($fq_atype);
# 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/\s+/ /g;
$ptr = length $1 if $atype =~ s/(\*+)//;
$atype =~ s/^\s+//;
$atype =~ s/\s+$//;
if ($atype =~ /(.*)\[(.*)\]$/) {
($array, $atype) = ($2, $1);
$atype =~ s/\s+$//;
}
$fq_atype = $atype . ('*' x $ptr);
if ($ptr>0 && exists $TypeString{$fq_atype}) {
$ptr = 0;
$tstr = $TypeString{$fq_atype};
} elsif ($ptr>0 && exists $TypeString{"$atype*"}) {
--$ptr;
$tstr = $TypeString{"$atype*"};
} elsif (!exists $TypeString{$atype}) {
errmesg $file, $func, "untraceable type \`$atype", '*'x$ptr, "\'";
} else {
$tstr = $TypeString{$atype};
}
return ("*" x $ptr) . ($array?"[$array]":"") . $tstr;
}
##############################################################################
# Given information about an API function, rewrite that function with
# updated tracing information.
#
sub rewrite_func ($$$$$) {
my ($file, $type, $name, $args, $body) = @_;
my ($arg,$trace);
my (@arg_name, @arg_str);
local $_;
# Parse return value
my $rettype = argstring $file, $name, $type;
goto error if $rettype =~ /!/;
# Parse arguments
if ($args eq "void") {
$trace = "H5TRACE0(\"$rettype\",\"\");\n";
} else {
# Split arguments. First convert `/*in,out*/' to get rid of the
# comma, then split the arguments on commas.
$args =~ s/(\/\*\s*in),\s*(out\s*\*\/)/$1_$2/g;
my @args = split /,[\s\n]*/, $args;
my $argno = 0;
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) {
errmesg $file, $name, "unable to parse \`$arg\'";
goto error;
} else {
my ($atype, $aname, $array, $adir) = ($1, $3, $4, $6);
$names{$aname} = $argno++;
$adir ||= "in";
$atype =~ s/\s+$//;
push @arg_name, $aname;
if ($adir eq "out") {
push @arg_str, "x";
} else {
if (defined $array) {
$atype .= "*";
if ($array =~ /^\[\/\*([a-z_A-Z]\w*)\*\/\]$/) {
my $asize = $1;
if (exists $names{$asize}) {
$atype .= '[a' . $names{$asize} . ']';
} else {
warn "bad array size: $asize";
$atype .= "*";
}
}
}
push @arg_str, argstring $file, $name, $atype;
}
}
}
$trace = "H5TRACE" . scalar(@arg_str) . "(\"$rettype\", \"";
$trace .= join("", @arg_str) . "\"";
my $len = 4 + length $trace;
for (@arg_name) {
if ($len + length >= 77) {
$trace .= ",\n $_";
$len = 13 + length;
} else {
$trace .= ", $_";
$len += 1 + length;
}
}
$trace .= ");\n";
}
goto error if grep {/!/} @arg_str;
# 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";
}
} 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) {
# Added an H5TRACE macro after a FUNC_ENTER macro.
} else {
errmesg $file, $name, "unable to insert tracing information";
print "body = ", $body, "\n";
goto error;
}
error:
return "\n$type\n$name($args)\n$body";
}
##############################################################################
# Process each source file, rewriting API functions with updated
# tracing information.
#
my $total_api = 0;
for $file (@ARGV) {
# Ignore some files that do not need tracing macros
unless ($file eq "H5FDmulti.c" or $file eq "src/H5FDmulti.c" or $file eq "H5FDstdio.c" or $file eq "src/H5FDstdio.c") {
# Snarf up the entire file
open SOURCE, $file or die "$file: $!\n";
$Source = join "", <SOURCE>;
close SOURCE;
# Make modifications
my $original = $Source;
my $napi = $Source =~ s/\n([A-Za-z]\w*(\s+[a-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 ($original ne $Source) {
printf "%s: instrumented %d API function%s\n",
$file, $napi, 1==$napi?"":"s";
rename $file, "$file~" or die "unable to make backup";
open SOURCE, ">$file" or die "unable to modify source";
print SOURCE $Source;
close SOURCE;
}
}
}

77
hdf5_1_8_10/bin/yodconfigure Executable file
View File

@@ -0,0 +1,77 @@
#!/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.
#
# Fix configure file so that it can launch configure testing executable
# via the proper launching command, e.g., yod. (Thus the name yodconfigure
# is used.)
#
# Author: Albert Cheng
if [ "$1" = -f ]; then
FORCEMODE=yes
echo turn FORCEMODE to $FORCEMODE
shift
fi
if [ $# -ne 1 ]; then
echo "Usage: $0 [-f] <configure file>"
echo " -f apply the change even if it has been applied already."
exit 1
fi
confile=$1
if [ ! -w $confile ]; then
echo "$0: $confile is not writable"
exit 1
fi
ACTRY_NAME="ACTRY()"
if grep ^"$ACTRY_NAME"$ $confile >/dev/null 2>&1 && [ "$FORCEMODE" != yes ]; then
echo "$0: $confile is already yodconfigure ready. Use -f to force yodconfigure again."
exit 1
fi
# Insert the ACTRY function after the 1st line which is the #!/bin/sh.
# Change all "eval $ac_try" commands to call ACTRY.
# auto-configure have changed the ac_try syntax from 'eval $ac_try' to
# 'eval "$ac_try"'. Thus requiring two very similar global-substitute.
# The single quotes around EOF tell shell NOT to expand or do substitution in
# the body of ed input.
#
ed - $confile <<'EOF'
1a
# ===inserted by yodconfigure ====
# ACTRY will figure out when it is approprirate to run the command by the
# $RUNSERIAL launcher (e.g., yod -sz 1) and when to just run it as is.
# So far, ./a.out and ./conftest are names of real executable that should
# be run by $RUNSERIAL.
#
# (uncomment the echo line if you want to see what is going on.)
ACTRY()
{
#echo ACTRY: args are: $* > /dev/tty
if [ "$1" = ./a.out -o "$1" = ./conftest ]; then
# echo $RUNSERIAL $* > /dev/tty
$RUNSERIAL $*
else
$*
fi
}
# === end of ACTRY inserted by yodconfigure ====
.
g/eval $ac_try/s/eval/eval ACTRY/
g/eval "$ac_try"/s/eval/eval ACTRY/
w
q
EOF

View File

@@ -0,0 +1,53 @@
cmake_minimum_required (VERSION 2.8.6)
PROJECT (HDF5_CPP)
#-----------------------------------------------------------------------------
# Apply Definitions to compiler in this directory and below
#-----------------------------------------------------------------------------
ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS})
#-----------------------------------------------------------------------------
# Shared/Static Libs
#-----------------------------------------------------------------------------
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 (${HDF5_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)

16
hdf5_1_8_10/c++/COPYING Normal file
View File

@@ -0,0 +1,16 @@
Copyright by The HDF Group and
The Board of Trustees of the University of Illinois.
All rights reserved.
The files and subdirectories in this directory are 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://www.hdfgroup.org/HDF5/doc/Copyright.html. If you do not
have access to either file, you may request a copy from
help@hdfgroup.org.

View File

@@ -0,0 +1,45 @@
#
# 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.
##
## Makefile.am
## Run automake to generate a Makefile.in from this file.
#
# Top-level HDF5-C++ Makefile(.in)
#
include $(top_srcdir)/config/commence.am
## Only recurse into subdirectories if C++ interface is enabled.
if BUILD_CXX_CONDITIONAL
SUBDIRS=src test
endif
DIST_SUBDIRS = src test examples
# Install examples
install-examples uninstall-examples:
@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
installcheck-local:
@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
# Clean examples when check-clean is invoked
check-clean ::
@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
@for d in X $(SUBDIRS) examples; do \
if test $$d != X && test $$d != .; then \
(set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
done
include $(top_srcdir)/config/conclude.am

1015
hdf5_1_8_10/c++/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
cmake_minimum_required (VERSION 2.8.6)
# --------------------------------------------------------------------
# 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
)
FOREACH (example ${examples})
ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
TARGET_NAMING (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})
IF (BUILD_TESTING)
# 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})
ENDIF (BUILD_TESTING)

View File

@@ -0,0 +1,62 @@
#
# 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.
##
## Makefile.am
## Run automake to generate a Makefile.in from this file.
##
#
# HDF5 Library Examples Makefile(.in)
#
include $(top_srcdir)/config/commence.am
# 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.
EXAMPLE_PROG=create readdata writedata compound extend_ds chunks h5group
TEST_SCRIPT=testh5c++.sh
# 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_SCRIPT_FILES = run-c++-ex.sh
# Some of the examples depend on files created by running other examples
readdata.chkexe_: create.chkexe_
chunks.chkexe_: extend_ds.chkexe_
# Tell conclude.am that these are C++ tests.
CXX_API=yes
# Where to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/c++
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
$(H5CPP) $(H5CCFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/$@.cpp
# List dependencies for each program. Normally, automake would take
# care of this for us, but if we tell automake about the programs it
# will try to build them with the normal C++ compiler, not h5c++. This is
# an inelegant way of solving the problem, unfortunately.
create: $(srcdir)/create.cpp
readdata: $(srcdir)/readdata.cpp
writedata: $(srcdir)/writedata.cpp
compound: $(srcdir)/compound.cpp
extend_ds: $(srcdir)/extend_ds.cpp
chunks: $(srcdir)/chunks.cpp
h5group: $(srcdir)/h5group.cpp
include $(top_srcdir)/config/examples.am
include $(top_srcdir)/config/conclude.am

View File

@@ -0,0 +1,930 @@
# Makefile.in generated by automake 1.12.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
#
# 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.
#
# HDF5 Library Examples Makefile(.in)
#
# We can't tell automake about example programs, because they need to be
# built using h5cc (or h5fc, etc.) instead of the standard compilers.
# This creates some extra work for us.
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/run-c++-ex.sh.in $(srcdir)/testh5c++.sh.in \
$(top_srcdir)/bin/mkinstalldirs \
$(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/examples.am
TESTS = $(TEST_SCRIPT)
subdir = c++/examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
CONFIG_CLEAN_FILES = run-c++-ex.sh testh5c++.sh
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tty_colors_dummy = \
mgn= red= grn= lgn= blu= brg= std=; \
am__color_tests=no
am__tty_colors = $(am__tty_colors_dummy)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@
AMTAR = @AMTAR@
# H5_CFLAGS holds flags that should be used when building hdf5,
# but which should not be exported to h5cc for building other programs.
# AM_CFLAGS is an automake construct which should be used by Makefiles
# instead of CFLAGS, as CFLAGS is reserved solely for the user to define.
# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well.
AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@
AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@
AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@
AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@
AM_MAKEFLAGS = @AM_MAKEFLAGS@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BYTESEX = @BYTESEX@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CC_VERSION = @CC_VERSION@
CFLAGS = @CFLAGS@
CLEARFILEBUF = @CLEARFILEBUF@
CODESTACK = @CODESTACK@
CONFIG_DATE = @CONFIG_DATE@
CONFIG_MODE = @CONFIG_MODE@
CONFIG_USER = @CONFIG_USER@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CXX_VERSION = @CXX_VERSION@
CYGPATH_W = @CYGPATH_W@
DEBUG_PKG = @DEBUG_PKG@
DEFAULT_API_VERSION = @DEFAULT_API_VERSION@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@
DIRECT_VFD = @DIRECT_VFD@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
DYNAMIC_DIRS = @DYNAMIC_DIRS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTERNAL_FILTERS = @EXTERNAL_FILTERS@
# Make sure that these variables are exported to the Makefiles
F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
FC2003 = @FC2003@
FCFLAGS = @FCFLAGS@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FC_VERSION = @FC_VERSION@
FGREP = @FGREP@
FILTERS = @FILTERS@
FSEARCH_DIRS = @FSEARCH_DIRS@
GPFS = @GPFS@
GREP = @GREP@
H5_CFLAGS = @H5_CFLAGS@
H5_CPPFLAGS = @H5_CPPFLAGS@
H5_CXXFLAGS = @H5_CXXFLAGS@
H5_CXX_SHARED = @H5_CXX_SHARED@
H5_FCFLAGS = @H5_FCFLAGS@
H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@
H5_LDFLAGS = @H5_LDFLAGS@
H5_LONE_COLON = @H5_LONE_COLON@
H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
HDF_FORTRAN = @HDF_FORTRAN@
HDF_FORTRAN2003 = @HDF_FORTRAN2003@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
HSIZE_T = @HSIZE_T@
HSSIZE_T = @HSSIZE_T@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_STATIC_EXEC = @LT_STATIC_EXEC@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
MPI_GET_SIZE = @MPI_GET_SIZE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PARALLEL = @PARALLEL@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
PTHREAD = @PTHREAD@
RANLIB = @RANLIB@
ROOT = @ROOT@
RUNPARALLEL = @RUNPARALLEL@
RUNSERIAL = @RUNSERIAL@
R_INTEGER = @R_INTEGER@
R_LARGE = @R_LARGE@
SEARCH = @SEARCH@
SED = @SED@
SETX = @SETX@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE_T = @SIZE_T@
STATIC_EXEC = @STATIC_EXEC@
STATIC_SHARED = @STATIC_SHARED@
STRICT_FORMAT_CHECKS = @STRICT_FORMAT_CHECKS@
STRIP = @STRIP@
TESTPARALLEL = @TESTPARALLEL@
THREADSAFE = @THREADSAFE@
TIME = @TIME@
TR = @TR@
TRACE_API = @TRACE_API@
UNAME_INFO = @UNAME_INFO@
USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@
USE_FILTER_FLETCHER32 = @USE_FILTER_FLETCHER32@
USE_FILTER_NBIT = @USE_FILTER_NBIT@
USE_FILTER_SCALEOFFSET = @USE_FILTER_SCALEOFFSET@
USE_FILTER_SHUFFLE = @USE_FILTER_SHUFFLE@
USE_FILTER_SZIP = @USE_FILTER_SZIP@
USINGMEMCHECKER = @USINGMEMCHECKER@
VERSION = @VERSION@
WORDS_BIGENDIAN = @WORDS_BIGENDIAN@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_FC = @ac_ct_FC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
# Install directories that automake doesn't know about
docdir = $(exec_prefix)/doc
dvidir = @dvidir@
enable_shared = @enable_shared@
enable_static = @enable_static@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
# Shell commands used in Makefiles
RM = rm -f
CP = cp
# Some machines need a command to run executables; this is that command
# so that our tests will run.
# We use RUNEXEC instead of RUNSERIAL directly because it may be that
# some tests need to be run with a different command. Older versions
# of the makefiles used the command
# $(LIBTOOL) --mode=execute
# in some directories, for instance.
RUNEXEC = $(RUNSERIAL)
# Libraries to link to while building
LIBHDF5 = $(top_builddir)/src/libhdf5.la
LIBH5TEST = $(top_builddir)/test/libh5test.la
LIBH5F = $(top_builddir)/fortran/src/libhdf5_fortran.la
LIBH5FTEST = $(top_builddir)/fortran/test/libh5test_fortran.la
LIBH5CPP = $(top_builddir)/c++/src/libhdf5_cpp.la
LIBH5TOOLS = $(top_builddir)/tools/lib/libh5tools.la
LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
# has been removed. According to the official description of DESTDIR by Gnu at
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
# prepended to the normal and complete install path that it precedes for the
# purpose of installing in a temporary directory which is useful for building
# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
# '/' at the beginning of the normal install path. When DESTDIR is empty the
# path then begins with '//', which is incorrect and causes problems at least for
# Cygwin.
# Scripts used to build examples
# If only shared libraries have been installed, have h5cc build examples with
# shared libraries instead of static libraries
H5CC = ${DESTDIR}$(bindir)/h5cc
H5CC_PP = ${DESTDIR}$(bindir)/h5pcc
H5FC = ${DESTDIR}$(bindir)/h5fc
H5FC_PP = ${DESTDIR}$(bindir)/h5pfc
H5CPP = ${DESTDIR}$(bindir)/h5c++
ACLOCAL_AMFLAGS = "-I m4"
# The trace script; this is used on source files from the C library to
# insert tracing macros.
TRACE = perl $(top_srcdir)/bin/trace
# .chkexe files are used to mark tests that have run successfully.
# .chklog files are output from those tests.
# *.clog are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5
# 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.
EXAMPLE_PROG = create readdata writedata compound extend_ds chunks h5group
TEST_SCRIPT = testh5c++.sh
# 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_SCRIPT_FILES = run-c++-ex.sh
# Tell conclude.am that these are C++ tests.
CXX_API = yes
# Where to install examples
# Note: no '/' after DESTDIR. Explanation in commence.am
EXAMPLEDIR = ${DESTDIR}$(exec_prefix)/share/hdf5_examples/c++
# Assume that all tests in this directory are examples, and tell
# conclude.am when to build them.
EXTRA_PROG = $(EXAMPLE_PROG) $(EXAMPLE_PROG_PARA)
# We need to tell automake what to clean
MOSTLYCLEANFILES = *.raw *.meta *.o
CLEANFILES = $(EXAMPLE_PROG) $(EXAMPLE_PROG_PARA)
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
# EXTRA_TEST variables are supplied to allow the user to force targets to
# be built at certain times.
LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
$(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
$(EXTRA_PROG)
chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS =
TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_)
TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign c++/examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign c++/examples/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
run-c++-ex.sh: $(top_builddir)/config.status $(srcdir)/run-c++-ex.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testh5c++.sh: $(top_builddir)/config.status $(srcdir)/testh5c++.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile all-local
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-data-local
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am: installcheck-local
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
mostlyclean-local
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-local
.MAKE: check-am install-am install-strip
.PHONY: all all-am all-local check check-TESTS check-am clean \
clean-generic clean-libtool distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-data-local install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installcheck-local installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-local
# List all build rules defined by HDF5 Makefiles as "PHONY" targets here.
# This tells the Makefiles that these targets are not files to be built but
# commands that should be executed even if a file with the same name already
# exists.
.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \
build-tests check-clean check-install check-p check-s check-vfd \
install-doc lib progs tests uninstall-doc _exec_check-s _test help
help:
@$(top_srcdir)/bin/makehelp
# Some of the examples depend on files created by running other examples
readdata.chkexe_: create.chkexe_
chunks.chkexe_: extend_ds.chkexe_
# How to build programs using h5c++
$(EXTRA_PROG): $(H5CPP)
$(H5CPP) $(H5CCFLAGS) $(CPPFLAGS) -o $@ $(srcdir)/$@.cpp
# List dependencies for each program. Normally, automake would take
# care of this for us, but if we tell automake about the programs it
# will try to build them with the normal C++ compiler, not h5c++. This is
# an inelegant way of solving the problem, unfortunately.
create: $(srcdir)/create.cpp
readdata: $(srcdir)/readdata.cpp
writedata: $(srcdir)/writedata.cpp
compound: $(srcdir)/compound.cpp
extend_ds: $(srcdir)/extend_ds.cpp
chunks: $(srcdir)/chunks.cpp
h5group: $(srcdir)/h5group.cpp
# How to create EXAMPLEDIR if it doesn't already exist
$(EXAMPLEDIR):
-$(top_srcdir)/bin/mkdirs $@
$(EXAMPLETOPDIR):
-$(top_srcdir)/bin/mkdirs $@
# Install and uninstall rules. We install the source files, not the
# example programs themselves.
install-data-local:
@$(MAKE) $(AM_MAKEFLAGS) install-examples
uninstall-local:
@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
install-examples: $(EXAMPLEDIR) $(INSTALL_FILES)
@for f in X $(INSTALL_FILES); do \
if test $$f != X; then \
(set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1); \
chmod a-x $(EXAMPLEDIR)/$$f; \
fi; \
done
@for f in X $(INSTALL_SCRIPT_FILES); do \
if test $$f != X; then \
(set -x; $(INSTALL) $$f $(EXAMPLEDIR)/. || exit 1);\
fi; \
done
@for f in X $(INSTALL_TOP_FILES); do \
if test $$f != X; then \
(set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
chmod a-x $(EXAMPLETOPDIR)/$$f;\
fi; \
done
@for f in X $(INSTALL_TOP_SCRIPT_FILES); do \
if test $$f != X; then \
(set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLETOPDIR)/. || exit 1); \
fi; \
done
uninstall-examples:
@if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then \
set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES); \
fi
@if test -n "$(INSTALL_SCRIPT_FILES)" -a -d $(EXAMPLEDIR); then \
set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_SCRIPT_FILES); \
fi
@if test -n "$(INSTALL_TOP_FILES)" -a -d $(EXAMPLETOPDIR); then \
set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_FILES); \
fi
@if test -n "$(INSTALL_TOP_SCRIPT_FILES)" -a -d $(EXAMPLETOPDIR); then \
set -x; cd $(EXAMPLETOPDIR) && $(RM) $(INSTALL_TOP_SCRIPT_FILES); \
fi
installcheck-local:
@if test "$(STATIC_SHARED)" = "static, shared"; then \
H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check; \
$(MAKE) $(AM_MAKEFLAGS) clean; \
H5CCFLAGS="" $(MAKE) $(AM_MAKEFLAGS) check; \
elif test "$(STATIC_SHARED)" = "shared"; then \
H5CCFLAGS="-shlib" $(MAKE) $(AM_MAKEFLAGS) check; \
else \
$(MAKE) $(AM_MAKEFLAGS) check; \
fi
# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.
build-lib: $(LIB)
build-progs: $(LIB) $(PROGS)
build-tests: $(LIB) $(PROGS) $(chk_TESTS)
# General rule for recursive building targets.
# BUILT_SOURCES contain targets that need to be built before anything else
# in the directory (e.g., for Fortran type detection)
lib progs tests check-s check-p :: $(BUILT_SOURCES)
@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
@for d in X $(SUBDIRS); do \
if test $$d != X && test $$d != .; then \
(set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
done
# General rule for recursive cleaning targets. Like the rule above,
# but doesn't require building BUILT_SOURCES.
check-clean ::
@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
@for d in X $(SUBDIRS); do \
if test $$d != X && test $$d != .; then \
(set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
fi; \
done
# Tell Automake to build tests when the user types `make all' (this is
# not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since
# Automake won't build them automatically, either.
all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS)
# make install-doc doesn't do anything outside of doc directory, but
# Makefiles should recognize it.
# UPDATE: docs no longer reside in this build tree, so this target
# is depreciated.
install-doc uninstall-doc:
@echo "Nothing to be done."
# clean up files generated by tests so they can be re-run.
build-check-clean:
$(RM) -rf $(CHECK_CLEANFILES)
# run check-clean whenever mostlyclean is run
mostlyclean-local: build-check-clean
# check-install is just a synonym for installcheck
check-install: installcheck
# Run each test in order, passing $(TEST_FLAGS) to the program.
# Since tests are done in a shell loop, "make -i" does apply inside it.
# Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop.
# The timestamps give a rough idea how much time the tests use.
#
# Note that targets in chk_TESTS (defined above) will be built when the user
# types 'make tests' or 'make check', but only programs in TEST_PROG,
# TEST_PROG_PARA, or TEST_SCRIPT will actually be executed.
check-TESTS: test
test _test:
@$(MAKE) build-check-s
@$(MAKE) build-check-p
# Actual execution of check-s.
build-check-s: $(LIB) $(PROGS) $(chk_TESTS)
@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \
echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
fi
@$(MAKE) $(AM_MAKEFLAGS) _exec_check-s
@if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \
echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
fi
_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH)
# The dummy.chkexe here prevents the target from being
# empty if there are no tests in the current directory.
# $${log} is the log file.
# $${tname} is the name of test.
$(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \
tname=$(@:.chkexe_=)$(EXEEXT);\
log=$(@:.chkexe_=.chklog); \
echo "============================"; \
if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
echo "No need to test $${tname} again."; \
else \
echo "============================" > $${log}; \
if test "X$(FORTRAN_API)" = "Xyes"; then \
echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
elif test "X$(CXX_API)" = "Xyes"; then \
echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
else \
echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
fi; \
echo "============================" >> $${log}; \
srcdir="$(srcdir)" \
$(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $(@:.chkexe_=.chkexe) || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
echo "" >> $${log}; \
echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
echo "============================" >> $${log}; \
echo "Finished testing $${tname} $(TEST_FLAGS)"; \
cat $${log}; \
fi; \
fi
# The dummysh.chkexe here prevents the target from being
# empty if there are no tests in the current directory.
# $${log} is the log file.
# $${tname} is the name of test.
$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_:
@if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \
cmd=$(@:.chkexe_=);\
tname=`basename $$cmd`;\
chkname=`basename $(@:.chkexe_=.chkexe)`;\
log=`basename $(@:.chkexe_=.chklog)`; \
echo "============================"; \
if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \
echo "No need to test $${tname} again."; \
else \
echo "============================" > $${log}; \
if test "X$(FORTRAN_API)" = "Xyes"; then \
echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \
echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
elif test "X$(CXX_API)" = "Xyes"; then \
echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \
echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
else \
echo "Testing $${tname} $(TEST_FLAGS)"; \
echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
fi; \
echo "============================" >> $${log}; \
RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \
srcdir="$(srcdir)" \
$(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \
&& touch $${chkname} || \
(test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
(cat $${log} && false) || exit 1; \
echo "" >> $${log}; \
echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
echo "============================" >> $${log}; \
echo "Finished testing $${tname} $(TEST_FLAGS)"; \
cat $${log}; \
fi; \
echo "============================"; \
fi
# Actual execution of check-p.
build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
@if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \
echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \
fi
@if test -n "$(TEST_PROG_PARA)"; then \
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
echo "**** end of Hint ****"; \
fi
@for test in $(TEST_PROG_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \
RUNEXEC="$(RUNPARALLEL)" || exit 1; \
fi; \
done
@for test in $(TEST_SCRIPT_PARA) dummy; do \
if test $$test != dummy; then \
$(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \
fi; \
done
@if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \
echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\
fi
# Run test with different Virtual File Driver
check-vfd: $(LIB) $(PROGS) $(chk_TESTS)
@for vfd in $(VFD_LIST) dummy; do \
if test $$vfd != dummy; then \
echo "============================"; \
echo "Testing Virtual File Driver $$vfd"; \
echo "============================"; \
$(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \
HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \
fi; \
done
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,240 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 shows how to read data from a chunked dataset.
* We will read from the file created by extend.cpp
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "SDSextendible.h5" );
const H5std_string DATASET_NAME( "ExtendibleArray" );
const int NX = 10;
const int NY = 5;
const int RANK = 2;
const int RANKC = 1;
int main (void)
{
hsize_t i, j;
// 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 the file and the dataset.
*/
H5File file( FILE_NAME, H5F_ACC_RDONLY );
DataSet dataset = file.openDataSet( DATASET_NAME );
/*
* Get filespace for rank and dimension
*/
DataSpace filespace = dataset.getSpace();
/*
* Get number of dimensions in the file dataspace
*/
int rank = filespace.getSimpleExtentNdims();
/*
* Get and print the dimension sizes of the file dataspace
*/
hsize_t dims[2]; // dataset dimensions
rank = filespace.getSimpleExtentDims( dims );
cout << "dataset rank = " << rank << ", dimensions "
<< (unsigned long)(dims[0]) << " x "
<< (unsigned long)(dims[1]) << endl;
/*
* Define the memory space to read dataset.
*/
DataSpace mspace1(RANK, dims);
/*
* Read dataset back and display.
*/
int data_out[NX][NY]; // buffer for dataset to be read
dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace );
cout << "\n";
cout << "Dataset: \n";
for (j = 0; j < dims[0]; j++)
{
for (i = 0; i < dims[1]; i++)
cout << data_out[j][i] << " ";
cout << endl;
}
/*
* dataset rank 2, dimensions 10 x 5
* chunk rank 2, dimensions 2 x 5
* Dataset:
* 1 1 1 3 3
* 1 1 1 3 3
* 1 1 1 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
*/
/*
* Read the third column from the dataset.
* First define memory dataspace, then define hyperslab
* and read it into column array.
*/
hsize_t col_dims[1];
col_dims[0] = 10;
DataSpace mspace2( RANKC, col_dims );
/*
* Define the column (hyperslab) to read.
*/
hsize_t offset[2] = { 0, 2 };
hsize_t count[2] = { 10, 1 };
int column[10]; // buffer for column to be read
/*
* Define hyperslab and read.
*/
filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
dataset.read( column, PredType::NATIVE_INT, mspace2, filespace );
cout << endl;
cout << "Third column: " << endl;
for (i = 0; i < 10; i++)
cout << column[i] << endl;
/*
* Third column:
* 1
* 1
* 1
* 0
* 0
* 0
* 0
* 0
* 0
* 0
*/
/*
* Get creation properties list.
*/
DSetCreatPropList cparms = dataset.getCreatePlist();
/*
* Check if dataset is chunked.
*/
hsize_t chunk_dims[2];
int rank_chunk;
if( H5D_CHUNKED == cparms.getLayout() )
{
/*
* Get chunking information: rank and dimensions
*/
rank_chunk = cparms.getChunk( 2, chunk_dims);
cout << "chunk rank " << rank_chunk << "dimensions "
<< (unsigned long)(chunk_dims[0]) << " x "
<< (unsigned long)(chunk_dims[1]) << endl;
/*
* Define the memory space to read a chunk.
*/
DataSpace mspace3( rank_chunk, chunk_dims );
/*
* Define chunk in the file (hyperslab) to read.
*/
offset[0] = 2;
offset[1] = 0;
count[0] = chunk_dims[0];
count[1] = chunk_dims[1];
filespace.selectHyperslab( H5S_SELECT_SET, count, offset );
/*
* Read chunk back and display.
*/
int chunk_out[2][5]; // buffer for chunk to be read
dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace );
cout << endl;
cout << "Chunk:" << endl;
for (j = 0; j < chunk_dims[0]; j++)
{
for (i = 0; i < chunk_dims[1]; i++)
cout << chunk_out[j][i] << " ";
cout << endl;
}
/*
* Chunk:
* 1 1 1 0 0
* 2 0 0 0 0
*/
}
} // 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;
}

View File

@@ -0,0 +1,213 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 shows how to create a compound datatype,
* write an array which has the compound datatype to the file,
* and read back fields' subsets.
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "SDScompound.h5" );
const H5std_string DATASET_NAME( "ArrayOfStructures" );
const H5std_string MEMBER1( "a_name" );
const H5std_string MEMBER2( "b_name" );
const H5std_string MEMBER3( "c_name" );
const int LENGTH = 10;
const int RANK = 1;
int main(void)
{
/* First structure and dataset*/
typedef struct s1_t {
int a;
float b;
double c;
} s1_t;
/* Second structure (subset of s1_t) and dataset*/
typedef struct s2_t {
double c;
int a;
} s2_t;
// Try block to detect exceptions raised by any of the calls inside it
try
{
/*
* Initialize the data
*/
int i;
s1_t s1[LENGTH];
for (i = 0; i< LENGTH; i++)
{
s1[i].a = i;
s1[i].b = i*i;
s1[i].c = 1./(i+1);
}
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
*/
Exception::dontPrint();
/*
* Create the data space.
*/
hsize_t dim[] = {LENGTH}; /* Dataspace dimensions */
DataSpace space( RANK, dim );
/*
* Create the file.
*/
H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
/*
* Create the memory datatype.
*/
CompType mtype1( sizeof(s1_t) );
mtype1.insertMember( MEMBER1, HOFFSET(s1_t, a), PredType::NATIVE_INT);
mtype1.insertMember( MEMBER3, HOFFSET(s1_t, c), PredType::NATIVE_DOUBLE);
mtype1.insertMember( MEMBER2, HOFFSET(s1_t, b), PredType::NATIVE_FLOAT);
/*
* Create the dataset.
*/
DataSet* dataset;
dataset = new DataSet(file->createDataSet(DATASET_NAME, mtype1, space));
/*
* Write data to the dataset;
*/
dataset->write( s1, mtype1 );
/*
* Release resources
*/
delete dataset;
delete file;
/*
* Open the file and the dataset.
*/
file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
dataset = new DataSet (file->openDataSet( DATASET_NAME ));
/*
* Create a datatype for s2
*/
CompType mtype2( sizeof(s2_t) );
mtype2.insertMember( MEMBER3, HOFFSET(s2_t, c), PredType::NATIVE_DOUBLE);
mtype2.insertMember( MEMBER1, HOFFSET(s2_t, a), PredType::NATIVE_INT);
/*
* Read two fields c and a from s1 dataset. Fields in the file
* are found by their names "c_name" and "a_name".
*/
s2_t s2[LENGTH];
dataset->read( s2, mtype2 );
/*
* Display the fields
*/
cout << endl << "Field c : " << endl;
for( i = 0; i < LENGTH; i++)
cout << s2[i].c << " ";
cout << endl;
cout << endl << "Field a : " << endl;
for( i = 0; i < LENGTH; i++)
cout << s2[i].a << " ";
cout << endl;
/*
* Create a datatype for s3.
*/
CompType mtype3( sizeof(float) );
mtype3.insertMember( MEMBER2, 0, PredType::NATIVE_FLOAT);
/*
* Read field b from s1 dataset. Field in the file is found by its name.
*/
float s3[LENGTH]; // Third "structure" - used to read float field of s1
dataset->read( s3, mtype3 );
/*
* Display the field
*/
cout << endl << "Field b : " << endl;
for( i = 0; i < LENGTH; i++)
cout << s3[i] << " ";
cout << endl;
/*
* Release resources
*/
delete dataset;
delete file;
} // 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 DataSpace operations
catch( DataTypeIException error )
{
error.printError();
return -1;
}
return 0;
}

View File

@@ -0,0 +1,134 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 writes a dataset to a new HDF5 file.
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "SDS.h5" );
const H5std_string DATASET_NAME( "IntArray" );
const int NX = 5; // dataset dimensions
const int NY = 6;
const int RANK = 2;
int main (void)
{
/*
* Data initialization.
*/
int i, j;
int data[NX][NY]; // buffer for data to write
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
data[j][i] = i + j;
}
/*
* 0 1 2 3 4 5
* 1 2 3 4 5 6
* 2 3 4 5 6 7
* 3 4 5 6 7 8
* 4 5 6 7 8 9
*/
// 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 H5F_ACC_TRUNC access,
* default file creation properties, and default file
* access properties.
*/
H5File file( FILE_NAME, H5F_ACC_TRUNC );
/*
* Define the size of the array and create the data space for fixed
* size dataset.
*/
hsize_t dimsf[2]; // dataset dimensions
dimsf[0] = NX;
dimsf[1] = NY;
DataSpace dataspace( RANK, dimsf );
/*
* Define datatype for the data in the file.
* We will store little endian INT numbers.
*/
IntType datatype( PredType::NATIVE_INT );
datatype.setOrder( H5T_ORDER_LE );
/*
* Create a new dataset within the file using defined dataspace and
* datatype and default dataset creation properties.
*/
DataSet dataset = file.createDataSet( DATASET_NAME, datatype, dataspace );
/*
* 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;
}
// catch failure caused by the DataSpace operations
catch( DataSpaceIException error )
{
error.printError();
return -1;
}
// catch failure caused by the DataSpace operations
catch( DataTypeIException error )
{
error.printError();
return -1;
}
return 0; // successfully terminated
}

View File

@@ -0,0 +1,81 @@
Data set has INTEGER type
Little endian byte ordering (0)
Data size is 4
rank 2, dimensions 5 x 6
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
3 4 5 6 0 0 0
4 5 6 7 0 0 0
5 6 7 8 0 0 0
0 0 0 0 0 0 0
10 0 11 12 0 0 0 0 0
18 0 19 20 0 21 22 0 0
0 59 0 61 0 0 0 0 0
0 0 27 28 0 29 30 0 0
0 0 35 36 67 37 38 0 0
0 0 43 44 0 45 46 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
Field c :
1 0.5 0.333333 0.25 0.2 0.166667 0.142857 0.125 0.111111 0.1
Field a :
0 1 2 3 4 5 6 7 8 9
Field b :
0 1 4 9 16 25 36 49 64 81
1 1 1 3 3
1 1 1 3 3
1 1 1 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
dataset rank = 2, dimensions 10 x 5
Dataset:
1 1 1 3 3
1 1 1 3 3
1 1 1 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
2 0 0 0 0
Third column:
1
1
1
0
0
0
0
0
0
0
chunk rank 2dimensions 2 x 5
Chunk:
1 1 1 0 0
2 0 0 0 0
dataset "/Data/Compressed_Data" is open
dataset "/Data_new/Compressed_Data" is open
Iterating over elements in the file
Name : Data
Name : Data_new
Unlinking...
"Data" is unlinked
Iterating over elements in the file again
Name : Data_new

View File

@@ -0,0 +1,240 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 shows how to work with extendible dataset.
* In the current version of the library dataset MUST be
* chunked.
*
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "SDSextendible.h5" );
const H5std_string DATASET_NAME( "ExtendibleArray" );
const int NX = 10;
const int NY = 5;
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 the data space with unlimited dimensions.
*/
hsize_t dims[2] = { 3, 3}; // dataset dimensions at creation
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
DataSpace mspace1( RANK, dims, maxdims);
/*
* Create a new file. If file exists its contents will be overwritten.
*/
H5File file( FILE_NAME, H5F_ACC_TRUNC );
/*
* Modify dataset creation properties, i.e. enable chunking.
*/
DSetCreatPropList cparms;
hsize_t chunk_dims[2] ={2, 5};
cparms.setChunk( RANK, chunk_dims );
/*
* Set fill value for the dataset
*/
int fill_val = 0;
cparms.setFillValue( PredType::NATIVE_INT, &fill_val);
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
DataSet dataset = file.createDataSet( DATASET_NAME, PredType::NATIVE_INT, mspace1, cparms);
/*
* Extend the dataset. This call assures that dataset is at least 3 x 3.
*/
hsize_t size[2];
size[0] = 3;
size[1] = 3;
dataset.extend( size );
/*
* Select a hyperslab.
*/
DataSpace fspace1 = dataset.getSpace ();
hsize_t offset[2];
offset[0] = 0;
offset[1] = 0;
hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */
fspace1.selectHyperslab( H5S_SELECT_SET, dims1, offset );
/*
* Write the data to the hyperslab.
*/
int data1[3][3] = { {1, 1, 1}, /* data to write */
{1, 1, 1},
{1, 1, 1} };
dataset.write( data1, PredType::NATIVE_INT, mspace1, fspace1 );
/*
* Extend the dataset. Dataset becomes 10 x 3.
*/
hsize_t dims2[2] = { 7, 1}; /* data2 dimensions */
dims[0] = dims1[0] + dims2[0];
size[0] = dims[0];
size[1] = dims[1];
dataset.extend( size );
/*
* Select a hyperslab.
*/
DataSpace fspace2 = dataset.getSpace ();
offset[0] = 3;
offset[1] = 0;
fspace2.selectHyperslab( H5S_SELECT_SET, dims2, offset );
/*
* Define memory space
*/
DataSpace mspace2( RANK, dims2 );
/*
* Write the data to the hyperslab.
*/
int data2[7] = { 2, 2, 2, 2, 2, 2, 2};
dataset.write( data2, PredType::NATIVE_INT, mspace2, fspace2 );
/*
* Extend the dataset. Dataset becomes 10 x 5.
*/
hsize_t dims3[2] = { 2, 2}; /* data3 dimensions */
dims[1] = dims1[1] + dims3[1];
size[0] = dims[0];
size[1] = dims[1];
dataset.extend( size );
/*
* Select a hyperslab
*/
DataSpace fspace3 = dataset.getSpace ();
offset[0] = 0;
offset[1] = 3;
fspace3.selectHyperslab( H5S_SELECT_SET, dims3, offset );
/*
* Define memory space.
*/
DataSpace mspace3( RANK, dims3 );
/*
* Write the data to the hyperslab.
*/
int data3[2][2] = { {3, 3}, {3, 3} };
dataset.write( data3, PredType::NATIVE_INT, mspace3, fspace3 );
/*
* Read the data from this dataset and display it.
*/
int i, j;
int data_out[NX][NY];
for (i = 0; i < NX; i++)
{
for (j = 0; j < NY; j++)
data_out[i][j] = 0;
}
dataset.read( data_out, PredType::NATIVE_INT );
/*
* Resulting dataset
*
* 1 1 1 3 3
* 1 1 1 3 3
* 1 1 1 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
*/
/*
* Display the result.
*/
for (i=0; i < NX; i++)
{
for(j=0; j < NY; j++)
cout << data_out[i][j] << " ";
cout << endl;
}
} // 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 DataSpace operations
catch( DataTypeIException error )
{
error.printError();
return -1;
}
return 0;
}

View File

@@ -0,0 +1,249 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 creates a group in the file and dataset in the group.
* Hard link to the group object is created and the dataset is accessed
* under different names.
* Iterator function is used to find the object names in the root group.
* Note that the C++ API iterator function is not completed yet, thus
* the C version is used in this example.
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "Group.h5" );
const int RANK = 2;
// Operator function
extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo,
void *opdata);
int main(void)
{
hsize_t dims[2];
hsize_t cdims[2];
// 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 the named file, truncating the existing one if any,
* using default create and access property lists.
*/
H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
/*
* Create a group in the file
*/
Group* group = new Group( file->createGroup( "/Data" ));
/*
* Create dataset "Compressed Data" in the group using absolute
* name. Dataset creation property list is modified to use
* GZIP compression with the compression effort set to 6.
* Note that compression can be used only when dataset is chunked.
*/
dims[0] = 1000;
dims[1] = 20;
cdims[0] = 20;
cdims[1] = 20;
DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
DSetCreatPropList ds_creatplist; // create dataset creation prop list
ds_creatplist.setChunk( 2, cdims ); // then modify it for compression
ds_creatplist.setDeflate( 6 );
/*
* Create the first dataset.
*/
DataSet* dataset = new DataSet(file->createDataSet(
"/Data/Compressed_Data", PredType::NATIVE_INT,
*dataspace, ds_creatplist ));
/*
* Close the first dataset.
*/
delete dataset;
delete dataspace;
/*
* Create the second dataset.
*/
dims[0] = 500;
dims[1] = 20;
dataspace = new DataSpace(RANK, dims); // create second dspace
dataset = new DataSet(file->createDataSet("/Data/Float_Data",
PredType::NATIVE_FLOAT, *dataspace));
delete dataset;
delete dataspace;
delete group;
delete file;
/*
* Now reopen the file and group in the file.
*/
file = new H5File(FILE_NAME, H5F_ACC_RDWR);
group = new Group(file->openGroup("Data"));
/*
* Access "Compressed_Data" dataset in the group.
*/
try { // to determine if the dataset exists in the group
dataset = new DataSet( group->openDataSet( "Compressed_Data" ));
}
catch( GroupIException not_found_error ) {
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data/Compressed_Data\" is open" << endl;
/*
* Close the dataset.
*/
delete dataset;
/*
* Create hard link to the Data group.
*/
file->link( H5L_TYPE_HARD, "Data", "Data_new" );
/*
* We can access "Compressed_Data" dataset using created
* hard link "Data_new".
*/
try { // to determine if the dataset exists in the file
dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" ));
}
catch( FileIException not_found_error )
{
cout << " Dataset is not found." << endl;
}
cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl;
/*
* Close the dataset.
*/
delete dataset;
/*
* Use iterator to see the names of the objects in the file
* root directory.
*/
cout << endl << "Iterating over elements in the file" << endl;
herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
cout << endl;
/*
* Unlink name "Data" and use iterator to see the names
* of the objects in the file root direvtory.
*/
cout << "Unlinking..." << endl;
try { // attempt to unlink the dataset
file->unlink( "Data" );
}
catch( FileIException unlink_error )
{
cout << " unlink failed." << endl;
}
cout << "\"Data\" is unlinked" << endl;
cout << endl << "Iterating over elements in the file again" << endl;
idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL);
cout << endl;
/*
* Close the group and file.
*/
delete group;
delete file;
} // 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 Attribute operations
catch( AttributeIException error )
{
error.printError();
return -1;
}
return 0;
}
/*
* Operator function.
*/
herr_t
file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata)
{
hid_t group;
/*
* Open the group using its name.
*/
group = H5Gopen2(loc_id, name, H5P_DEFAULT);
/*
* Display group name.
*/
cout << "Name : " << name << endl;
H5Gclose(group);
return 0;
}

View File

@@ -0,0 +1,222 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 reads hyperslab from the SDS.h5 file into
// two-dimensional plane of a three-dimensional array. Various
// information about the dataset in the SDS.h5 file is obtained.
//
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "SDS.h5" );
const H5std_string DATASET_NAME( "IntArray" );
const int NX_SUB = 3; // hyperslab dimensions
const int NY_SUB = 4;
const int NX = 7; // output buffer dimensions
const int NY = 7;
const int NZ = 3;
const int RANK_OUT = 3;
int main (void)
{
/*
* Output buffer initialization.
*/
int i, j, k;
int data_out[NX][NY][NZ ]; /* output buffer */
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
{
for (k = 0; k < NZ ; k++)
data_out[j][i][k] = 0;
}
}
/*
* 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 the specified file and the specified dataset in the file.
*/
H5File file( FILE_NAME, H5F_ACC_RDONLY );
DataSet dataset = file.openDataSet( DATASET_NAME );
/*
* Get the class of the datatype that is used by the dataset.
*/
H5T_class_t type_class = dataset.getTypeClass();
/*
* Get class of datatype and print message if it's an integer.
*/
if( type_class == H5T_INTEGER )
{
cout << "Data set has INTEGER type" << endl;
/*
* Get the integer datatype
*/
IntType intype = dataset.getIntType();
/*
* Get order of datatype and print message if it's a little endian.
*/
H5std_string order_string;
H5T_order_t order = intype.getOrder( order_string );
cout << order_string << endl;
/*
* Get size of the data element stored in file and print it.
*/
size_t size = intype.getSize();
cout << "Data size is " << size << endl;
}
/*
* Get dataspace of the dataset.
*/
DataSpace dataspace = dataset.getSpace();
/*
* Get the number of dimensions in the dataspace.
*/
int rank = dataspace.getSimpleExtentNdims();
/*
* Get the dimension size of each dimension in the dataspace and
* display them.
*/
hsize_t dims_out[2];
int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);
cout << "rank " << rank << ", dimensions " <<
(unsigned long)(dims_out[0]) << " x " <<
(unsigned long)(dims_out[1]) << endl;
/*
* Define hyperslab in the dataset; implicitly giving strike and
* block NULL.
*/
hsize_t offset[2]; // hyperslab offset in the file
hsize_t count[2]; // size of the hyperslab in the file
offset[0] = 1;
offset[1] = 2;
count[0] = NX_SUB;
count[1] = NY_SUB;
dataspace.selectHyperslab( H5S_SELECT_SET, count, offset );
/*
* Define the memory dataspace.
*/
hsize_t dimsm[3]; /* memory space dimensions */
dimsm[0] = NX;
dimsm[1] = NY;
dimsm[2] = NZ ;
DataSpace memspace( RANK_OUT, dimsm );
/*
* Define memory hyperslab.
*/
hsize_t offset_out[3]; // hyperslab offset in memory
hsize_t count_out[3]; // size of the hyperslab in memory
offset_out[0] = 3;
offset_out[1] = 0;
offset_out[2] = 0;
count_out[0] = NX_SUB;
count_out[1] = NY_SUB;
count_out[2] = 1;
memspace.selectHyperslab( H5S_SELECT_SET, count_out, offset_out );
/*
* Read data from hyperslab in the file into the hyperslab in
* memory and display the data.
*/
dataset.read( data_out, PredType::NATIVE_INT, memspace, dataspace );
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
cout << data_out[j][i][0] << " ";
cout << endl;
}
/*
* 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0
* 3 4 5 6 0 0 0
* 4 5 6 7 0 0 0
* 5 6 7 8 0 0 0
* 0 0 0 0 0 0 0
*/
} // 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 DataSpace operations
catch( DataTypeIException error )
{
error.printError();
return -1;
}
return 0; // successfully terminated
}

View File

@@ -0,0 +1,93 @@
#! /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:-../../../}"
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
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
fi
# Cleanup
rm *.o
rm *.h5
echo
exit $EXIT_VALUE

View File

@@ -0,0 +1,281 @@
#! /bin/sh
#
# 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.
#
# Tests for the h5c++ compiler tool
# Created: Albert Cheng, 2007/3/14
#
# Modification:
#
srcdir=@srcdir@
# Initializations
TESTNAME=h5c++
EXIT_SUCCESS=0
EXIT_FAILURE=1
# Where the tool is installed.
# Note: no '/' after DESTDIR. Explanation in commence.am
prefix="${prefix:-${DESTDIR}@prefix@}"
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=$EXIT_SUCCESS
verbose=yes
# setup my machine information.
myos=`uname -s`
myhostnama=`uname -n`
# Generate some source files and library for tests.
suffix=cpp # source file suffix
hdf5main=${H5TOOL}_hdf5main.$suffix
hdf5main_o=${H5TOOL}_hdf5main.o
appmain=${H5TOOL}_appmain.$suffix
appmain_o=${H5TOOL}_appmain.o
prog1=${H5TOOL}_prog1.$suffix
prog1_o=${H5TOOL}_prog1.o
prog2=${H5TOOL}_prog2.$suffix
prog2_o=${H5TOOL}_prog2.o
applib=libapp${H5TOOL}.a
# short hands
# Caution: if some *.h5 files must be cleaned here, list them by names.
# Don't use the wildcard form of *.h5 as it will wipe out even *.h5 generated
# by otehr test programs. This will cause a racing condition error when
# parallel make (e.g., gmake -j 4) is used.
temp_SRC="$hdf5main $appmain $prog1 $prog2"
temp_OBJ=`echo $temp_SRC | sed -e "s/\.${suffix}/.o/g"`
temp_FILES="a.out $applib"
# Generate appmain:
# An application Main that calls hdf5 and application's own functions.
cat > $appmain <<EOF
#include <string>
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "tmpapp.h5" );
int sub1(void);
int sub2(void);
int main (void)
{
sub1();
sub2();
H5File file( FILE_NAME, H5F_ACC_TRUNC );
return 0;
}
EOF
# generate prog1
cat > $prog1 <<EOF
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
int sub1(void)
{
cout << "in sub1" << endl;
return 0;
}
EOF
# generate prog2
cat > $prog2 <<EOF
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
int sub2(void)
{
cout << "in sub2" << endl;
return 0;
}
EOF
# Generate HDF5 Main Program:
# An HDF5 sample program that calls hdf5 functions.
cat > $hdf5main <<EOF
#include <string>
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "tmphdf5.h5" );
int main (void)
{
H5File file( FILE_NAME, H5F_ACC_TRUNC );
return 0;
}
EOF
# Parse option
# None
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
#
TESTING() {
SPACES=" "
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Debug printing
# Change : to echo to print the debug statement
DPRINT() {
: $*
}
# Run a test and print PASS or *FAIL*. If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the
# failed output. The actual output is not removed if $HDF5_NOCLEANUP is
# defined.
#
TOOLTEST() {
out=test_$H5TOOL_$$.out
err=test_$H5TOOL_$$.err
# Run test.
TESTING $H5TOOL $@
$H5TOOL_BIN $@ > $out 2>&1
result=$?
if [ $result = 0 ]; then
echo " PASSED"
else
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && \
( echo "========== results ==========="; cat $out;
echo "===============================================") |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $out
fi
}
# Print a "SKIP" message
SKIP() {
TESTING $H5TOOL $@
echo " -SKIP-"
}
##############################################################################
### T H E T E S T S ###
##############################################################################
#
# HDF5 program that calls HDF5 APIs.
echo "***"Simple Compile and Link in one step.
TOOLTEST $hdf5main
# Application program that calls HDF5 and its own functions.
TOOLTEST $appmain $prog1 $prog2
# Compile, then link.
echo "***"Compile and Link in two steps.
TOOLTEST -c $hdf5main
TOOLTEST $hdf5main_o
TOOLTEST -c $appmain $prog1 $prog2
TOOLTEST $appmain_o $prog1_o $prog2_o
# Build external library, then link with it.
echo "***"Build external library and link with it.
TOOLTEST -c $prog1 $prog2
rm -f $applib
$AR cru $applib $prog1_o $prog2_o
$RANLIB $applib
TOOLTEST $appmain $applib
TOOLTEST $appmain_o $applib
# This is peculiar but should work. (See bug ID 729)
TOOLTEST -c $hdf5main
rm -f $applib
$AR cru $applib $hdf5main_o
$RANLIB $applib
# SunOS does not support this. Skip it.
if [ $myos = SunOS ]; then
SKIP -o a.out $applib
else
TOOLTEST -o a.out $applib
fi
# Just preprocess, no compile, no link.
echo "***"Just preprocess, no compile, no link.
TOOLTEST -E $hdf5main
TOOLTEST -E $appmain $prog1 $prog2
##############################################################################
# END
##############################################################################
# Clean up file
if test -z "$HDF5_NOCLEANUP"; then
rm -f $temp_SRC $temp_OBJ $temp_FILES
fi
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS
else
echo "$TESTNAME tests failed with $nerrors errors."
exit $EXIT_FAILURE
fi

View File

@@ -0,0 +1,338 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 program shows how the select_hyperslab and select_elements
* functions are used to write selected data from memory to the file.
* Program takes 48 elements from the linear buffer and writes them into
* the matrix using 3x2 blocks, (4,3) stride and (2,4) count.
* Then four elements of the matrix are overwritten with the new values and
* file is closed. Program reopens the file and reads and displays the result.
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
#include "H5Cpp.h"
#ifndef H5_NO_NAMESPACE
using namespace H5;
#endif
const H5std_string FILE_NAME( "Select.h5" );
const H5std_string DATASET_NAME( "Matrix in file" );
const int MSPACE1_RANK = 1; // Rank of the first dataset in memory
const int MSPACE1_DIM = 50; // Dataset size in memory
const int MSPACE2_RANK = 1; // Rank of the second dataset in memory
const int MSPACE2_DIM = 4; // Dataset size in memory
const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file
const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is
const int FSPACE_DIM2 = 12; // stored in the file
const int MSPACE_RANK = 2; // Rank of the first dataset in memory
const int MSPACE_DIM1 = 8; // We will read dataset back from the file
const int MSPACE_DIM2 = 9; // to the dataset in memory with these
// dataspace parameters
const int NPOINTS = 4; // Number of points that will be selected
// and overwritten
int main (void)
{
int i,j; // loop indices */
/*
* 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 file.
*/
H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC );
/*
* Create property list for a dataset and set up fill values.
*/
int fillvalue = 0; /* Fill value for the dataset */
DSetCreatPropList plist;
plist.setFillValue(PredType::NATIVE_INT, &fillvalue);
/*
* Create dataspace for the dataset in the file.
*/
hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk)
DataSpace fspace( FSPACE_RANK, fdim );
/*
* Create dataset and write it into the file.
*/
DataSet* dataset = new DataSet(file->createDataSet(
DATASET_NAME, PredType::NATIVE_INT, fspace, plist));
/*
* Select hyperslab for the dataset in the file, using 3x2 blocks,
* (4,3) stride and (2,4) count starting at the position (0,1).
*/
hsize_t start[2]; // Start of hyperslab
hsize_t stride[2]; // Stride of hyperslab
hsize_t count[2]; // Block count
hsize_t block[2]; // Block sizes
start[0] = 0; start[1] = 1;
stride[0] = 4; stride[1] = 3;
count[0] = 2; count[1] = 4;
block[0] = 3; block[1] = 2;
fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
/*
* Create dataspace for the first dataset.
*/
hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset
(in memory) */
DataSpace mspace1( MSPACE1_RANK, dim1 );
/*
* Select hyperslab.
* We will use 48 elements of the vector buffer starting at the
* second element. Selected elements are 1 2 3 . . . 48
*/
start[0] = 1;
stride[0] = 1;
count[0] = 48;
block[0] = 1;
mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block);
/*
* Write selection from the vector buffer to the dataset in the file.
*
* File dataset should look like this:
* 0 1 2 0 3 4 0 5 6 0 7 8
* 0 9 10 0 11 12 0 13 14 0 15 16
* 0 17 18 0 19 20 0 21 22 0 23 24
* 0 0 0 0 0 0 0 0 0 0 0 0
* 0 25 26 0 27 28 0 29 30 0 31 32
* 0 33 34 0 35 36 0 37 38 0 39 40
* 0 41 42 0 43 44 0 45 46 0 47 48
* 0 0 0 0 0 0 0 0 0 0 0 0
*/
int vector[MSPACE1_DIM]; // vector buffer for dset
/*
* Buffer initialization.
*/
vector[0] = vector[MSPACE1_DIM - 1] = -1;
for (i = 1; i < MSPACE1_DIM - 1; i++)
vector[i] = i;
dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace );
/*
* Reset the selection for the file dataspace fid.
*/
fspace.selectNone();
/*
* Create dataspace for the second dataset.
*/
hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset
(in memory */
DataSpace mspace2( MSPACE2_RANK, dim2 );
/*
* Select sequence of NPOINTS points in the file dataspace.
*/
hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points
from the file dataspace */
coord[0][0] = 0; coord[0][1] = 0;
coord[1][0] = 3; coord[1][1] = 3;
coord[2][0] = 3; coord[2][1] = 5;
coord[3][0] = 5; coord[3][1] = 6;
fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord);
/*
* Write new selection of points to the dataset.
*/
int values[] = {53, 59, 61, 67}; /* New values to be written */
dataset->write( values, PredType::NATIVE_INT, mspace2, fspace );
/*
* File dataset should look like this:
* 53 1 2 0 3 4 0 5 6 0 7 8
* 0 9 10 0 11 12 0 13 14 0 15 16
* 0 17 18 0 19 20 0 21 22 0 23 24
* 0 0 0 59 0 61 0 0 0 0 0 0
* 0 25 26 0 27 28 0 29 30 0 31 32
* 0 33 34 0 35 36 67 37 38 0 39 40
* 0 41 42 0 43 44 0 45 46 0 47 48
* 0 0 0 0 0 0 0 0 0 0 0 0
*
*/
/*
* Close the dataset and the file.
*/
delete dataset;
delete file;
/*
* Open the file.
*/
file = new H5File( FILE_NAME, H5F_ACC_RDONLY );
/*
* Open the dataset.
*/
dataset = new DataSet( file->openDataSet( DATASET_NAME ));
/*
* Get dataspace of the dataset.
*/
fspace = dataset->getSpace();
/*
* Select first hyperslab for the dataset in the file. The following
* elements are selected:
* 10 0 11 12
* 18 0 19 20
* 0 59 0 61
*
*/
start[0] = 1; start[1] = 2;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 3; count[1] = 4;
fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
/*
* Add second selected hyperslab to the selection.
* The following elements are selected:
* 19 20 0 21 22
* 0 61 0 0 0
* 27 28 0 29 30
* 35 36 67 37 38
* 43 44 0 45 46
* 0 0 0 0 0
* Note that two hyperslabs overlap. Common elements are:
* 19 20
* 0 61
*/
start[0] = 2; start[1] = 4;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 6; count[1] = 5;
fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
/*
* Create memory dataspace.
*/
hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the
dataset in memory when we
read selection from the
dataset on the disk */
DataSpace mspace(MSPACE_RANK, mdim);
/*
* Select two hyperslabs in memory. Hyperslabs has the same
* size and shape as the selected hyperslabs for the file dataspace.
*/
start[0] = 0; start[1] = 0;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 3; count[1] = 4;
mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block);
start[0] = 1; start[1] = 2;
block[0] = 1; block[1] = 1;
stride[0] = 1; stride[1] = 1;
count[0] = 6; count[1] = 5;
mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block);
/*
* Initialize data buffer.
*/
int matrix_out[MSPACE_DIM1][MSPACE_DIM2];
for (i = 0; i < MSPACE_DIM1; i++)
for (j = 0; j < MSPACE_DIM2; j++)
matrix_out[i][j] = 0;
/*
* Read data back to the buffer matrix.
*/
dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace);
/*
* Display the result. Memory dataset is:
*
* 10 0 11 12 0 0 0 0 0
* 18 0 19 20 0 21 22 0 0
* 0 59 0 61 0 0 0 0 0
* 0 0 27 28 0 29 30 0 0
* 0 0 35 36 67 37 38 0 0
* 0 0 43 44 0 45 46 0 0
* 0 0 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0 0 0
*/
for (i=0; i < MSPACE_DIM1; i++)
{
for(j=0; j < MSPACE_DIM2; j++)
cout << matrix_out[i][j] << " ";
cout << endl;
}
/*
* Close the dataset and the file.
*/
delete dataset;
delete file;
} // 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;
}

View File

@@ -0,0 +1,118 @@
cmake_minimum_required (VERSION 2.8.6)
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 (${HDF5_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}/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}/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_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)
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
INSTALL (
FILES
${CPP_HDRS}
DESTINATION
${HDF5_INSTALL_INCLUDE_DIR}/cpp
COMPONENT
cppheaders
)
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
IF (HDF5_EXPORTED_TARGETS)
INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries)
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)

View File

@@ -0,0 +1,323 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5Alltypes.h"
#include <iostream> // remove when done
using std::cerr;
using std::endl;
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
//--------------------------------------------------------------------------
// Function: AbstractDs default constructor
///\brief Default constructor
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AbstractDs::AbstractDs(){}
//--------------------------------------------------------------------------
// Function: AbstractDs default constructor
///\brief Creates an AbstractDs instance using an existing id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
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
//--------------------------------------------------------------------------
AbstractDs::AbstractDs(const AbstractDs& original){}
//--------------------------------------------------------------------------
// Function: AbstractDs::getTypeClass
///\brief Returns the class of the datatype that is used by this
/// object, which can be a dataset or an attribute.
///\return Datatype class identifier
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_class_t AbstractDs::getTypeClass() const
{
// Gets the datatype used by this dataset or attribute.
// p_get_type calls either H5Dget_type or H5Aget_type depending on
// which object invokes getTypeClass
hid_t datatype_id;
try {
datatype_id = p_get_type(); // returned value is already validated
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg());
}
// Gets the class of the datatype and validate it before returning
H5T_class_t type_class = H5Tget_class(datatype_id);
// Close temporary datatype_id
herr_t ret_value = H5Tclose(datatype_id);
if (ret_value < 0)
{
if (fromClass() == "DataSet")
throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed");
else if (fromClass() == "Attribute")
throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed");
}
// Check on the returned type_class
if (type_class == H5T_NO_CLASS)
{
if (fromClass() == "DataSet")
throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
else if (fromClass() == "Attribute")
throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS");
}
return(type_class);
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getDataType
///\brief Returns the generic datatype of this abstract dataset, which
/// can be a dataset or an attribute.
///\return DataType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType AbstractDs::getDataType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getDataType. Then, create and
// return the DataType object
try {
DataType datatype(p_get_type());
return(datatype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getDataType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getDataType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getArrayType
///\brief Returns the array datatype of this abstract dataset which
/// can be a dataset or an attribute.
///\return ArrayType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
ArrayType AbstractDs::getArrayType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getArrayType. Then, create and
// return the ArrayType object
try {
ArrayType arraytype(p_get_type());
return(arraytype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getCompType
///\brief Returns the compound datatype of this abstract dataset which
/// can be a dataset or an attribute.
///\return CompType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType AbstractDs::getCompType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getCompType. Then, create and
// return the CompType object
try {
CompType comptype(p_get_type());
return(comptype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getCompType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getCompType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getEnumType
///\brief Returns the enumeration datatype of this abstract dataset which
/// can be a dataset or an attribute.
///\return EnumType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType AbstractDs::getEnumType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getEnumType. Then, create and
// return the EnumType object
try {
EnumType enumtype(p_get_type());
return(enumtype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getIntType
///\brief Returns the integer datatype of this abstract dataset which
/// can be a dataset or an attribute.
///\return IntType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IntType AbstractDs::getIntType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getIntType. Then, create and
// return the IntType object
try {
IntType inttype(p_get_type());
return(inttype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getIntType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getIntType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getFloatType
///\brief Returns the floating-point datatype of this abstract dataset,
/// which can be a dataset or an attribute.
///\return FloatType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FloatType AbstractDs::getFloatType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getFloatType. Then, create and
// return the FloatType object
try {
FloatType floatype(p_get_type());
return(floatype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getStrType
///\brief Returns the string datatype of this abstract dataset which
/// can be a dataset or an attribute.
///\return StrType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
StrType AbstractDs::getStrType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getStrType. Then, create and
// return the StrType object
try {
StrType strtype(p_get_type());
return(strtype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getStrType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getStrType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs::getVarLenType
///\brief Returns the floating-point datatype of this abstract dataset,
/// which can be a dataset or an attribute.
///\return VarLenType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
VarLenType AbstractDs::getVarLenType() const
{
// Gets the id of the datatype used by this dataset or attribute using
// p_get_type. p_get_type calls either H5Dget_type or H5Aget_type
// depending on which object invokes getVarLenType. Then, create and
// return the VarLenType object
try {
VarLenType varlentype(p_get_type());
return(varlentype);
}
catch (DataSetIException E) {
throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg());
}
catch (AttributeIException E) {
throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: AbstractDs destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AbstractDs::~AbstractDs() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,91 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// 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 H5_NO_NAMESPACE
namespace H5 {
#endif
class ArrayType;
class CompType;
class EnumType;
class FloatType;
class IntType;
class StrType;
class VarLenType;
class H5_DLLCPP AbstractDs {
public:
// Gets a copy the datatype of that this abstract dataset uses.
// Note that this datatype is a generic one and can only be accessed
// via generic member functions, i.e., member functions belong
// to DataType. To get specific datatype, i.e. EnumType, FloatType,
// etc..., use the specific functions, that follow, instead.
DataType getDataType() const;
// Gets a copy of the specific datatype of this abstract dataset.
ArrayType getArrayType() const;
CompType getCompType() const;
EnumType getEnumType() const;
IntType getIntType() const;
FloatType getFloatType() const;
StrType getStrType() const;
VarLenType getVarLenType() const;
// Gets the size in memory of this abstract dataset.
virtual size_t getInMemDataSize() const = 0;
// 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.
virtual hsize_t getStorageSize() const = 0;
// Returns this class name
virtual H5std_string fromClass() const = 0;
// Copy constructor
AbstractDs( const AbstractDs& original );
// Destructor
virtual ~AbstractDs();
protected:
// Default constructor
AbstractDs();
// Constructor that takes an attribute id or a dataset id.
AbstractDs( const hid_t ds_id );
private:
// This member function is implemented by DataSet and Attribute.
virtual hid_t p_get_type() const = 0;
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif // _AbstractDs_H

View File

@@ -0,0 +1,29 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// This header file simply serves as a container to hold the
// header files of all datatypes. It simplifies the header
// file including in the code.
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5EnumType.h"
#include "H5IntType.h"
#include "H5FloatType.h"
#include "H5StrType.h"
#include "H5CompType.h"
#include "H5ArrayType.h"
#include "H5VarLenType.h"

View File

@@ -0,0 +1,167 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5ArrayType.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
//--------------------------------------------------------------------------
// Function: ArrayType default constructor
///\brief Default constructor: Creates a stub ArrayType
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType() : DataType()
{
// Initialize members
rank = -1;
dimensions = NULL;
}
//--------------------------------------------------------------------------
// Function: ArrayType overloaded constructor
///\brief Creates an ArrayType object using an existing id.
///\param existing_id - IN: Id of an existing datatype
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id )
{
// Get the rank of the existing array and store it in this array
rank = H5Tget_array_ndims(existing_id);
if (rank < 0)
{
throw DataTypeIException("ArrayType overloaded constructor", "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");
}
//--------------------------------------------------------------------------
// Function: ArrayType copy constructor
///\brief Copy constructor: makes a copy of the original ArrayType object.
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType( const ArrayType& original ) : DataType( original )
{
rank = original.rank;
dimensions = new hsize_t[rank];
for (int i = 0; i < rank; i++)
dimensions[i] = original.dimensions[i];
}
//--------------------------------------------------------------------------
// Function: ArrayType overloaded constructor
///\brief Creates a new array data type based on the specified
/// \a base_type.
///\param base_type - IN: Existing datatype
///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK]
///\param dims - IN: Size of each array dimension
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) : DataType()
{
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];
}
//--------------------------------------------------------------------------
// Function: ArrayType::getArrayNDims
///\brief Returns the number of dimensions for an array datatype.
///\return Number of dimensions
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
int ArrayType::getArrayNDims()
{
// If the array's rank has not been stored, i.e. rank is init to -1,
// retrieve it via the C API
if (rank < 0)
{
rank = H5Tget_array_ndims(id);
if (rank < 0)
{
throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed");
}
}
return(rank);
}
//--------------------------------------------------------------------------
// Function: ArrayType::getArrayDims
///\brief Retrieves the size of all dimensions of an array datatype.
///\param dims - OUT: Sizes of dimensions
///\return Number of dimensions
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
int ArrayType::getArrayDims(hsize_t* dims)
{
// 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
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'
for (int i = 0; i < rank; i++)
dims[i] = dimensions[i];
return(rank);
}
//--------------------------------------------------------------------------
// Function: ArrayType destructor
///\brief Properly terminates access to this array datatype.
// Programmer Binh-Minh Ribler - May 2004
//--------------------------------------------------------------------------
ArrayType::~ArrayType()
{
// Free allocated memory
if (dimensions != NULL)
delete []dimensions;
}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,62 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// Class ArrayType inherits from DataType and provides wrappers for the
// HDF5 C's Array Datatypes.
#ifndef _H5ArrayType_H
#define _H5ArrayType_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP ArrayType : public DataType {
public:
// Constructor that creates a new array data type based on the
// specified base type.
ArrayType(const DataType& base_type, int ndims, const hsize_t* dims);
// Returns the number of dimensions of this array datatype.
int getArrayNDims();
// Returns the sizes of dimensions of this array datatype.
int getArrayDims(hsize_t* dims);
///\brief Returns this class name
virtual H5std_string fromClass () const { return("ArrayType"); }
// Copy constructor: makes copy of the original object.
ArrayType( const ArrayType& original );
// Constructor that takes an existing id
ArrayType( const hid_t existing_id );
// Noop destructor
virtual ~ArrayType();
protected:
// Default constructor
ArrayType();
private:
int rank; // Rank of the array
hsize_t* dimensions; // Sizes of the array dimensions
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,297 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
#ifndef DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: AtomType default constructor [protected]
// Purpose Default constructor: creates a stub atomic datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AtomType::AtomType() : DataType() {}
//--------------------------------------------------------------------------
// Function: AtomType overloaded constructor [protected]
// Purpose Creates an AtomType object using an existing id.
// Parameter existing_id - IN: Id of an existing datatype
// Exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AtomType::AtomType( const hid_t existing_id ) : DataType( existing_id ) {}
#endif // DOXYGEN_SHOULD_SKIP_THIS
//--------------------------------------------------------------------------
// Function: AtomType copy constructor
///\brief Copy constructor: makes a copy of the original AtomType object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AtomType::AtomType( const AtomType& original ) : DataType( original ) {}
//--------------------------------------------------------------------------
// Function: AtomType::setSize
///\brief Sets the total size for an atomic datatype.
///\param size - IN: Size to set
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setSize( size_t size ) const
{
// Call C routine H5Tset_size to set the total size
herr_t ret_value = H5Tset_size( id, size );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed");
}
}
//--------------------------------------------------------------------------
// Function: AtomType::getOrder
///\brief Returns the byte order of an atomic datatype.
///\return Byte order, which can be:
/// \li \c H5T_ORDER_LE
/// \li \c H5T_ORDER_BE
/// \li \c H5T_ORDER_VAX
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
H5T_order_t AtomType::getOrder() const
{
// Call C routine to get the byte ordering
H5T_order_t type_order = H5Tget_order( id );
// return a byte order constant if successful
if( type_order == H5T_ORDER_ERROR )
{
throw DataTypeIException(inMemFunc("getOrder"),
"H5Tget_order returns H5T_ORDER_ERROR");
}
return( type_order );
}
//--------------------------------------------------------------------------
// Function: AtomType::getOrder
///\brief This is an overloaded member function, provided for convenience.
/// It takes a reference to a \c H5std_string for the buffer that
/// provide the text description of the returned byte order.
/// The text description can be either of the following:
/// "Little endian byte ordering (0)";
/// "Big endian byte ordering (1)";
/// "VAX mixed byte ordering (2)";
///\param order_string - OUT: Text description of the returned byte order
///\return Byte order, which can be:
/// \li \c H5T_ORDER_LE
/// \li \c H5T_ORDER_BE
/// \li \c H5T_ORDER_VAX
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_order_t AtomType::getOrder( H5std_string& order_string ) const
{
// Call the overloaded to get the type order without text
H5T_order_t type_order = getOrder();
// Then provide the text and return the type order
if( type_order == H5T_ORDER_LE )
order_string = "Little endian byte ordering (0)";
else if( type_order == H5T_ORDER_BE )
order_string = "Big endian byte ordering (1)";
else if( type_order == H5T_ORDER_VAX )
order_string = "VAX mixed byte ordering (2)";
return( type_order );
}
//--------------------------------------------------------------------------
// Function: AtomType::setOrder
///\brief Sets the byte ordering of an atomic datatype.
///\param order - IN: Byte ordering constant, which can be:
/// \li \c H5T_ORDER_LE
/// \li \c H5T_ORDER_BE
/// \li \c H5T_ORDER_VAX
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setOrder( H5T_order_t order ) const
{
// Call C routine to set the byte ordering
herr_t ret_value = H5Tset_order( id, order );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed");
}
}
//--------------------------------------------------------------------------
// Function: AtomType::getPrecision
///\brief Returns the precision of an atomic datatype.
///\return Number of significant bits
///\exception H5::DataTypeIException
///\par Description
/// The precision is the number of significant bits which,
/// unless padding is present, is 8 times larger than the
/// value returned by \c DataType::getSize().
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
size_t AtomType::getPrecision() const
{
size_t num_signi_bits = H5Tget_precision( id ); // C routine
// returns number of significant bits if successful
if( num_signi_bits == 0 )
{
throw DataTypeIException(inMemFunc("getPrecision"),
"H5Tget_precision returns invalid number of significant bits");
}
return( num_signi_bits );
}
//--------------------------------------------------------------------------
// Function: AtomType::setPrecision
///\brief Sets the precision of an atomic datatype.
///\param precision - IN: Number of bits of precision
///\exception H5::DataTypeIException
///\par Description
/// For information, please see C layer Reference Manuat at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetPrecision
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setPrecision( size_t precision ) const
{
// Call C routine to set the datatype precision
herr_t ret_value = H5Tset_precision( id, precision );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed");
}
}
//--------------------------------------------------------------------------
// Function: AtomType::getOffset
///\brief Retrieves the bit offset of the first significant bit.
///\return Offset value
///\exception H5::DataTypeIException
///\par Description
/// For information, please see C layer Reference Manuat at:
/// 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
// - return type changed from size_t to int
// - offset = -1 when failure occurs vs. 0
//--------------------------------------------------------------------------
int AtomType::getOffset() const
{
int offset = H5Tget_offset( id ); // C routine
// returns a non-negative offset value if successful
if( offset == -1 )
{
throw DataTypeIException(inMemFunc("getOffset"),
"H5Tget_offset returns a negative offset value");
}
return( offset );
}
//--------------------------------------------------------------------------
// Function: AtomType::setOffset
///\brief Sets the bit offset of the first significant bit.
///\param offset - IN: Offset of first significant bit
///\exception H5::DataTypeIException
///\par Description
/// For information, please see C layer Reference Manuat at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-SetOffset
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setOffset( size_t offset ) const
{
// Call C routine to set the bit offset
herr_t ret_value = H5Tset_offset( id, offset );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed");
}
}
//--------------------------------------------------------------------------
// Function: AtomType::getPad
///\brief Retrieves the padding type of the least and most-significant
/// bit padding.
///\param lsb - OUT: Least-significant bit padding type
///\param msb - OUT: Most-significant bit padding type
///\exception H5::DataTypeIException
///\par Description
/// Possible values for \a lsb and \a msb include:
/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
/// \li \c H5T_PAD_ONE (1) - Set background to ones.
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const
{
// Call C routine to get the padding type
herr_t ret_value = H5Tget_pad( id, &lsb, &msb );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed");
}
}
//--------------------------------------------------------------------------
// Function: AtomType::setPad
///\brief Sets the least and most-significant bits padding types.
///\param lsb - IN: Least-significant bit padding type
///\param msb - IN: Most-significant bit padding type
///\exception H5::DataTypeIException
///\par Description
/// Valid values for \a lsb and \a msb include:
/// \li \c H5T_PAD_ZERO (0) - Set background to zeros.
/// \li \c H5T_PAD_ONE (1) - Set background to ones.
/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void AtomType::setPad( H5T_pad_t lsb, H5T_pad_t msb ) const
{
// Call C routine to set the padding type
herr_t ret_value = H5Tset_pad( id, lsb, msb );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed");
}
}
//--------------------------------------------------------------------------
// Function: AtomType destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
AtomType::~AtomType() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,81 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// 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 H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP AtomType : public DataType {
public:
// Returns the byte order of an atomic datatype.
H5T_order_t getOrder() const;
H5T_order_t getOrder( H5std_string& order_string ) const;
// Sets the byte ordering of an atomic datatype.
void setOrder( H5T_order_t order ) const;
// Retrieves the bit offset of the first significant bit.
// 12/05/00 - changed return type to int from size_t - C API
int getOffset() const;
// Sets the bit offset of the first significant bit.
void setOffset( size_t offset ) const;
// Retrieves the padding type of the least and most-significant bit padding.
void getPad( H5T_pad_t& lsb, H5T_pad_t& msb ) const;
// Sets the least and most-significant bits padding types
void setPad( H5T_pad_t lsb, H5T_pad_t msb ) const;
// Returns the precision of an atomic datatype.
size_t getPrecision() const;
// Sets the precision of an atomic datatype.
void setPrecision( size_t precision ) const;
// Sets the total size for an atomic datatype.
void setSize( size_t size ) const;
///\brief Returns this class name
virtual H5std_string fromClass () const { return("AtomType"); }
// Copy constructor - makes copy of the original object
AtomType( const AtomType& original );
// Noop destructor
virtual ~AtomType();
protected:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Default constructor
AtomType();
// Constructor that takes an existing id
AtomType( const hid_t existing_id );
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,556 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5File.h"
#include "H5Attribute.h"
#include "H5private.h" // for HDfree
#ifndef H5_NO_NAMESPACE
namespace H5 {
#ifndef H5_NO_STD
using std::cerr;
using std::endl;
#endif // H5_NO_STD
#endif
//--------------------------------------------------------------------------
// Function: Attribute default constructor
///\brief Default constructor: Creates a stub attribute
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
Attribute::Attribute() : AbstractDs(), IdComponent(), id(0) {}
//--------------------------------------------------------------------------
// Function: Attribute copy constructor
///\brief Copy constructor: makes a copy of the original Attribute object.
///\param original - IN: Original Attribute object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent()
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
// Function: Attribute overloaded constructor
///\brief Creates an Attribute object using the id of an existing
/// attribute.
///\param existing_id - IN: Id of an existing attribute
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent()
{
id = existing_id;
}
//--------------------------------------------------------------------------
// Function: Attribute::write
///\brief Writes data to this attribute.
///\param mem_type - IN: Attribute datatype (in memory)
///\param buf - IN: Data to be written
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Attribute::write( const DataType& mem_type, const void *buf ) const
{
herr_t ret_value = H5Awrite( id, mem_type.getId(), buf );
if( ret_value < 0 )
{
throw AttributeIException("Attribute::write", "H5Awrite failed");
}
}
//--------------------------------------------------------------------------
// Function: Attribute::write
///\brief This is an overloaded member function, provided for convenience.
/// It writes a \a H5std_string to this attribute.
///\param mem_type - IN: Attribute datatype (in memory)
///\param strg - IN: Data to be written
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Apr, 2003
//--------------------------------------------------------------------------
void Attribute::write(const DataType& mem_type, const H5std_string& strg) const
{
// 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;
// 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");
}
}
//--------------------------------------------------------------------------
// Function: Attribute::read
///\brief Reads data from this attribute.
///\param mem_type - IN: Attribute datatype (in memory)
///\param buf - OUT: Buffer for read data
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Attribute::read( const DataType& mem_type, void *buf ) const
{
herr_t ret_value = H5Aread( id, mem_type.getId(), buf );
if( ret_value < 0 )
{
throw AttributeIException("Attribute::read", "H5Aread failed");
}
}
//--------------------------------------------------------------------------
// Function: Attribute::read
///\brief This is an overloaded member function, provided for convenience.
/// It reads a \a H5std_string from this attribute.
///\param mem_type - IN: Attribute datatype (in memory)
///\param strg - IN: Buffer for read string
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Apr, 2003
// Modification
// Mar 2008
// Corrected a misunderstanding that H5Aread would allocate
// space for the buffer. Obtained the attribute size and
// allocated memory properly. - BMR
// Apr 2009
// Used getInMemDataSize to get attribute data size. - BMR
// Jul 2009
// Divided into specific private functions for fixed- and
// variable-len string data: p_read_fixed_len and
// p_read_variable_len. This should improve readability.
//--------------------------------------------------------------------------
void Attribute::read(const DataType& mem_type, H5std_string& strg) const
{
// 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");
}
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);
}
}
//--------------------------------------------------------------------------
// 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);
}
//--------------------------------------------------------------------------
// Function: Attribute::getSpace
///\brief Gets a copy of the dataspace for this attribute.
///\return Dataspace instance
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace Attribute::getSpace() const
{
// Calls C function H5Aget_space to get the id of the dataspace
hid_t dataspace_id = H5Aget_space( id );
// If the dataspace id is valid, create and return the DataSpace object
if( dataspace_id > 0 )
{
DataSpace dataspace( dataspace_id );
return( dataspace );
}
else
{
throw AttributeIException("Attribute::getSpace", "H5Aget_space failed");
}
}
//--------------------------------------------------------------------------
// Function: Attribute::getFileName
///\brief Gets the name of the file, in which this attribute belongs.
///\return File name
///\exception H5::IdComponentException
// Programmer Binh-Minh Ribler - Jul, 2004
//--------------------------------------------------------------------------
H5std_string Attribute::getFileName() const
{
try {
return(p_get_file_name());
}
catch (IdComponentException E) {
throw FileIException("Attribute::getFileName", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// 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
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Nov, 2001
//--------------------------------------------------------------------------
ssize_t Attribute::getName( size_t buf_size, H5std_string& attr_name ) const
{
char* name_C = new char[buf_size+1]; // temporary C-string for C API
// 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 );
}
//--------------------------------------------------------------------------
// 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.
///\return Name of the attribute
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
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;
if (name_size >= 256)
name_size = getName(name_size, attr_name);
// otherwise, convert the C attribute name and return
else
attr_name = name_C;
delete []name_C;
return( attr_name );
}
//--------------------------------------------------------------------------
// Function: Attribute::getStorageSize
///\brief Returns the amount of storage size required for this attribute.
///\return Size of the storage or 0, for no data
///\exception H5::AttributeIException
// Note: H5Dget_storage_size returns 0 when there is no data. This
// function should have no failure. (from SLU)
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
hsize_t Attribute::getStorageSize() const
{
hsize_t storage_size = H5Aget_storage_size(id);
return (storage_size);
}
//--------------------------------------------------------------------------
// Function: Attribute::getId
// Purpose: Get the id of this attribute
// Description:
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDS and Attribute are moved out of H5Object. In
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
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
//--------------------------------------------------------------------------
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);
}
//--------------------------------------------------------------------------
// 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
// Description:
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Attribute::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
catch (Exception close_error) {
throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;
}
//--------------------------------------------------------------------------
// Function: Attribute::close
///\brief Closes this attribute.
///
///\exception H5::AttributeIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void Attribute::close()
{
if (p_valid_id(id))
{
herr_t ret_value = H5Aclose(id);
if( ret_value < 0 )
{
throw AttributeIException("Attribute::close", "H5Aclose failed");
}
// reset the id
id = 0;
}
}
//--------------------------------------------------------------------------
// Function: Attribute destructor
///\brief Properly terminates access to this attribute.
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
Attribute::~Attribute()
{
try {
close();
}
catch (Exception close_error) {
cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl;
}
}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,98 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5Attribute_H
#define _H5Attribute_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP Attribute : public AbstractDs, public IdComponent {
public:
// Closes this attribute.
virtual void close();
// Gets the name of the file, in which this attribute belongs.
H5std_string getFileName() const;
// Gets the name of this attribute.
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.
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;
void read( const DataType& mem_type, H5std_string& strg ) const;
// Writes data to this attribute.
void write(const DataType& mem_type, const void *buf ) const;
void write(const DataType& mem_type, const H5std_string& strg ) const;
///\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;
// Destructor: properly terminates access to this attribute.
virtual ~Attribute();
protected:
// Sets the attribute id.
virtual void p_setId(const hid_t new_id);
private:
hid_t id; // HDF5 attribute id
// This function contains the common code that is used by
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
// sub-types
virtual hid_t p_get_type() const;
// 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() {}
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,51 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5Classes_H
#define _H5Classes_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class Exception;
class IdComponent;
class H5Object;
class PropList;
class FileCreatPropList;
class FileAccPropList;
class DSetCreatPropList;
class DSetMemXferPropList;
class DTypePropList;
class DataType;
class DataSpace;
class AtomType;
class PredType;
class EnumType;
class IntType;
class FloatType;
class StrType;
class CompType;
//class RefType;
class AbstractDs;
class DataSet;
class Group;
class H5File;
class Attribute;
class H5Library;
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// 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 H5_NO_NAMESPACE
namespace H5 {
#endif
class Group;
class H5File;
class ArrayType;
class VarLenType;
class H5_DLLCPP CommonFG {
public:
// Creates a new group at this location which can be a file
// or another group.
Group createGroup(const char* name, size_t size_hint = 0) const;
Group createGroup(const H5std_string& name, size_t size_hint = 0) const;
// Opens an existing group in a location which can be a file
// or another group.
Group openGroup(const char* name) const;
Group openGroup(const H5std_string& name) const;
// Creates a new dataset at this location.
DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
DataSet createDataSet(const H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const;
// Opens an existing dataset at this location.
DataSet openDataSet(const char* name) const;
DataSet openDataSet(const H5std_string& name) const;
// Retrieves comment for the HDF5 object specified by its name.
H5std_string getComment(const char* name, size_t bufsize=256) const;
H5std_string getComment(const H5std_string& name, size_t bufsize=256) 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 value of a symbolic link.
H5std_string getLinkval(const char* link_name, size_t size=0) const;
H5std_string getLinkval(const H5std_string& link_name, size_t size=0) const;
// Returns the number of objects in this group.
hsize_t getNumObjs() const;
// Retrieves the name of an object in this group, given the
// object's index.
H5std_string getObjnameByIdx(hsize_t idx) const;
ssize_t getObjnameByIdx(hsize_t idx, char* name, size_t size) const;
ssize_t getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size) const;
#ifndef H5_NO_DEPRECATED_SYMBOLS
// Returns the type of an object in this group, given the
// object's index.
H5G_obj_t getObjTypeByIdx(hsize_t idx) const;
H5G_obj_t getObjTypeByIdx(hsize_t idx, char* type_name) const;
H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const;
// Returns information about an HDF5 object, given by its name,
// at this location.
void getObjinfo(const char* name, hbool_t follow_link, H5G_stat_t& statbuf) const;
void getObjinfo(const H5std_string& name, hbool_t follow_link, H5G_stat_t& statbuf) const;
void getObjinfo(const char* name, H5G_stat_t& statbuf) const;
void getObjinfo(const H5std_string& name, H5G_stat_t& statbuf) const;
// Iterates over the elements of this group - not implemented in
// C++ style yet.
int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data);
int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
// Creates a link of the specified type from new_name to current_name;
// both names are interpreted relative to the specified location id.
void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const;
void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const;
// Removes the specified name at this location.
void unlink(const char* name) const;
void unlink(const H5std_string& name) const;
// Mounts the file 'child' onto this location.
void mount(const char* name, H5File& child, PropList& plist) const;
void mount(const H5std_string& name, H5File& child, PropList& plist) const;
// Unmounts the file named 'name' from this parent location.
void unmount(const char* name) const;
void unmount(const H5std_string& name) const;
// Renames an object at this location.
void move(const char* src, const char* dst) const;
void move(const H5std_string& src, const H5std_string& dst) const;
// Opens a generic named datatype in this location.
DataType openDataType(const char* name) const;
DataType openDataType(const H5std_string& name) const;
// Opens a named array datatype in this location.
ArrayType openArrayType(const char* name) const;
ArrayType openArrayType(const H5std_string& name) const;
// Opens a named compound datatype in this location.
CompType openCompType(const char* name) const;
CompType openCompType(const H5std_string& name) const;
// Opens a named enumeration datatype in this location.
EnumType openEnumType(const char* name) const;
EnumType openEnumType(const H5std_string& name) const;
// Opens a named integer datatype in this location.
IntType openIntType(const char* name) const;
IntType openIntType(const H5std_string& name) const;
// Opens a named floating-point datatype in this location.
FloatType openFloatType(const char* name) const;
FloatType openFloatType(const H5std_string& name) const;
// Opens a named string datatype in this location.
StrType openStrType(const char* name) const;
StrType openStrType(const H5std_string& name) const;
// Opens a named variable length datatype in this location.
VarLenType openVarLenType(const char* name) const;
VarLenType openVarLenType(const H5std_string& name) const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/// For subclasses, H5File and Group, to return the correct
/// object id, i.e. file or group id.
virtual hid_t getLocId() const = 0;
#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;
// Default constructor.
CommonFG();
// Noop destructor.
virtual ~CommonFG();
}; // end of CommonFG declaration
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,462 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5Alltypes.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
#include "H5DataSet.h"
#include "H5private.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
//--------------------------------------------------------------------------
// Function: CompType default constructor
///\brief Default constructor: Creates a stub compound datatype
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType() : DataType() {}
//--------------------------------------------------------------------------
// Function: CompType copy constructor
///\brief Copy constructor: makes copy of the original CompType object
///\param original - IN: Original CompType instance
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType( const CompType& original ) : DataType( original ) {}
//--------------------------------------------------------------------------
// Function: CompType overloaded constructor
///\brief Creates a CompType object using the id of an existing datatype.
///\param existing_id - IN: Id of an existing compound datatype
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType( const hid_t existing_id ) : DataType( existing_id ) {}
//--------------------------------------------------------------------------
// Function: CompType overloaded constructor
///\brief Creates an empty compound datatype given a size, in bytes.
///\param size - IN: Number of bytes in the datatype to create
///\exception H5::DataTypeIException
// Description
// The DataType constructor calls the C API H5Tcreate to create
// the compound datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType( size_t size ) : DataType( H5T_COMPOUND, size ) {}
//--------------------------------------------------------------------------
// Function: CompType overloaded constructor
///\brief Gets the compound datatype of the specified dataset.
///\param dataset - IN: Dataset that this enum datatype associates with
///\return CompType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::CompType( const DataSet& dataset ) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type( dataset.getId() );
// If the datatype id is invalid, throw exception
if( id < 0 )
{
throw DataSetIException("CompType constructor", "H5Dget_type failed");
}
}
//--------------------------------------------------------------------------
// Function: CompType::getNmembers
///\brief Returns the number of members in this compound datatype.
///\return Number of members
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int CompType::getNmembers() const
{
int num_members = H5Tget_nmembers( id );
if( num_members < 0 )
{
throw DataTypeIException("CompType::getNmembers",
"H5Tget_nmembers returns negative number of members");
}
return( num_members );
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberName
///\brief Returns the name of a member in this compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return Name of member
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string CompType::getMemberName( unsigned member_num ) const
{
char* member_name_C = H5Tget_member_name( id, member_num );
if( member_name_C == NULL ) // NULL means failure
{
throw DataTypeIException("CompType::getMemberName",
"H5Tget_member_name returns NULL for member name");
}
H5std_string member_name = H5std_string(member_name_C); // convert C string to string
HDfree(member_name_C); // free the C string
return( member_name ); // return the member name string
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberIndex
///\brief Returns the index of a member in this compound datatype.
///\param name - IN: Name of the member
///\return Index of member
///\exception H5::DataTypeIException
///\par Description
/// Members are stored in no particular order with numbers 0
/// through N-1, where N is the value returned by the member
/// function \c CompType::getNmembers.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
int CompType::getMemberIndex(const char* name) const
{
int member_index = H5Tget_member_index(id, name);
if( member_index < 0 )
{
throw DataTypeIException("CompType::getMemberIndex",
"H5Tget_member_index returns negative value");
}
return( member_index );
}
int CompType::getMemberIndex(const H5std_string& name) const
{
return(getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberOffset
///\brief Returns the byte offset of the beginning of a member with
/// respect to the beginning of the compound data type datum.
///\param member_num - IN: Zero-based index of the member
///\return Byte offset
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
// Description
/// Members are stored in no particular order with numbers 0
/// through N-1, where N is the value returned by the member
/// function \c CompType::getNmembers.
//
// Note that byte offset being returned as 0 doesn't indicate
// a failure. (According to Quincey)
//--------------------------------------------------------------------------
size_t CompType::getMemberOffset( unsigned member_num ) const
{
size_t offset = H5Tget_member_offset( id, member_num );
return( offset );
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberClass
///\brief Gets the type class of the specified member.
///\param member_num - IN: Zero-based index of the member
///\return Type class of the member
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
// Modification
// Modified to use H5Tget_member_class instead. - Jul, 2005
//--------------------------------------------------------------------------
H5T_class_t CompType::getMemberClass( unsigned member_num ) const
{
H5T_class_t member_class = H5Tget_member_class(id, member_num);
if( member_class == H5T_NO_CLASS )
{
throw DataTypeIException("CompType::getMemberClass",
"H5Tget_member_class returns H5T_NO_CLASS");
}
return(member_class);
}
// This private member function calls the C API to get the identifier
// of the specified member. It provides the id to construct appropriate
// sub-types in the functions getMemberXxxType below, where Xxx indicates
// the sub-types.
hid_t CompType::p_get_member_type(unsigned member_num) const
{
// get the id of the specified member first
hid_t member_type_id = H5Tget_member_type( id, member_num );
if( member_type_id > 0 )
return( member_type_id );
else
{
// p_get_member_type is private, caller will catch this exception
// then throw another with appropriate API name
throw DataTypeIException("", "H5Tget_member_type failed");
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberDataType
///\brief Returns the generic datatype of the specified member in this
/// compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return DataType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType CompType::getMemberDataType( unsigned member_num ) const
{
try {
DataType datatype(p_get_member_type(member_num));
return(datatype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberArrayType
///\brief Returns the array datatype of the specified member in this
/// compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return ArrayType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
ArrayType CompType::getMemberArrayType( unsigned member_num ) const
{
try {
ArrayType arraytype(p_get_member_type(member_num));
return(arraytype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberCompType
///\brief Returns the compound datatype of the specified member in this
/// compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return CompType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType CompType::getMemberCompType( unsigned member_num ) const
{
try {
CompType comptype(p_get_member_type(member_num));
return(comptype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberEnumType
///\brief Returns the enumeration datatype of the specified member in
/// this compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return EnumType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType CompType::getMemberEnumType( unsigned member_num ) const
{
try {
EnumType enumtype(p_get_member_type(member_num));
return(enumtype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberIntType
///\brief Returns the integer datatype of the specified member in this
/// compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return IntType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
IntType CompType::getMemberIntType( unsigned member_num ) const
{
try {
IntType inttype(p_get_member_type(member_num));
return(inttype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberFloatType
///\brief Returns the floating-point datatype of the specified member
/// in this compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return FloatType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
FloatType CompType::getMemberFloatType( unsigned member_num ) const
{
try {
FloatType floatype(p_get_member_type(member_num));
return(floatype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberStrType
///\brief Returns the string datatype of the specified member in this
/// compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return StrType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
StrType CompType::getMemberStrType( unsigned member_num ) const
{
try {
StrType strtype(p_get_member_type(member_num));
return(strtype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: CompType::getMemberVarLenType
///\brief Returns the variable length datatype of the specified member
/// in this compound datatype.
///\param member_num - IN: Zero-based index of the member
///\return VarLenType instance
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jul, 2005
//--------------------------------------------------------------------------
VarLenType CompType::getMemberVarLenType( unsigned member_num ) const
{
try {
VarLenType varlentype(p_get_member_type(member_num));
return(varlentype);
}
catch (DataTypeIException E) {
throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg());
}
}
/* old style of getMemberType - using overloads; new style above
returns the appropriate datatypes but has different named functions.
In the old style, a datatype must be passed into the function.
May, 2004: These should be reconsidered to provide more convenience.
// Returns the datatype of the specified member in this compound datatype.
// Several overloading of getMemberType are for different datatypes
void CompType::getMemberType( unsigned member_num, EnumType& enumtype ) const
{
p_get_member_type(member_num, enumtype);
}
void CompType::getMemberType( unsigned member_num, CompType& comptype ) const
{
p_get_member_type(member_num, comptype);
}
void CompType::getMemberType( unsigned member_num, IntType& inttype ) const
{
p_get_member_type(member_num, inttype);
}
void CompType::getMemberType( unsigned member_num, FloatType& floatype ) const
{
p_get_member_type(member_num, floatype);
}
void CompType::getMemberType( unsigned member_num, StrType& strtype ) const
{
p_get_member_type(member_num, strtype);
}
// end of overloading of getMemberType
*/
//--------------------------------------------------------------------------
// Function: CompType::insertMember
///\brief Inserts a new member to this compound datatype.
///\param name - IN: Name of the new member
///\param offset - IN: Offset in memory structure of the field to insert
///\param new_member - IN: New member to be inserted
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void CompType::insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const
{
// Convert string to C-string
const char* name_C;
name_C = name.c_str(); // name_C refers to the contents of name as a C-str
hid_t new_member_id = new_member.getId(); // get new_member id for C API
// Call C routine H5Tinsert to add the new member
herr_t ret_value = H5Tinsert( id, name_C, offset, new_member_id );
if( ret_value < 0 )
{
throw DataTypeIException("CompType::insertMember", "H5Tinsert failed");
}
}
//--------------------------------------------------------------------------
// Function: CompType::pack
///\brief Recursively removes padding from within a compound datatype.
///
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void CompType::pack() const
{
// Calls C routine H5Tpack to remove padding
herr_t ret_value = H5Tpack( id );
if( ret_value < 0 )
{
throw DataTypeIException("CompType::pack", "H5Tpack failed");
}
}
//--------------------------------------------------------------------------
// Function: CompType destructor
///\brief Properly terminates access to this compound datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType::~CompType() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,114 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// Class CompType inherits from DataType and provides accesses to a compound
// datatype.
#ifndef _H5CompType_H
#define _H5CompType_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
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
H5T_class_t getMemberClass( unsigned member_num ) const;
// Returns the index of a member in this compound data type.
int getMemberIndex(const char* name) const;
int getMemberIndex(const H5std_string& name) const;
// Returns the offset of a member of this compound datatype.
size_t getMemberOffset( unsigned memb_no ) const;
// Returns the name of a member of this compound datatype.
H5std_string getMemberName( unsigned member_num ) const;
// Returns the generic datatype of the specified member in
// this compound datatype.
DataType getMemberDataType( unsigned member_num ) const;
// Returns the array datatype of the specified member in
// this compound datatype.
ArrayType getMemberArrayType( unsigned member_num ) const;
// Returns the compound datatype of the specified member in
// this compound datatype.
CompType getMemberCompType( unsigned member_num ) const;
// Returns the enumeration datatype of the specified member in
// this compound datatype.
EnumType getMemberEnumType( unsigned member_num ) const;
// Returns the integer datatype of the specified member in
// this compound datatype.
IntType getMemberIntType( unsigned member_num ) const;
// Returns the floating-point datatype of the specified member in
// this compound datatype.
FloatType getMemberFloatType( unsigned member_num ) const;
// Returns the string datatype of the specified member in
// this compound datatype.
StrType getMemberStrType( unsigned member_num ) const;
// Returns the variable length datatype of the specified member in
// this compound datatype.
VarLenType getMemberVarLenType( unsigned member_num ) const;
// Returns the number of members in this compound datatype.
int getNmembers() const;
// Adds a new member to this compound datatype.
void insertMember( const H5std_string& name, size_t offset, const DataType& new_member ) const;
// Recursively removes padding from within this compound datatype.
void pack() const;
///\brief Returns this class name
virtual H5std_string fromClass () const { return("CompType"); }
// Noop destructor.
virtual ~CompType();
private:
// Contains common code that is used by the member functions
// getMemberXxxType
hid_t p_get_member_type(unsigned member_num) const;
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,58 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5CPP_H
#define _H5CPP_H
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5DataSpace.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5Attribute.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DxferProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5AtomType.h"
#include "H5PredType.h"
#include "H5EnumType.h"
#include "H5IntType.h"
#include "H5FloatType.h"
#include "H5StrType.h"
#include "H5CompType.h"
#include "H5ArrayType.h"
#include "H5VarLenType.h"
#include "H5DataSet.h"
#include "H5Group.h"
#include "H5File.h"
#include "H5Library.h"
/* Some C++ compilers do not have offsetof macro; define to bypass the problem
- BMR- -EIP- 2007/08/01
*/
#ifndef H5_CXX_HAVE_OFFSETOF
#ifdef HOFFSET
#undef HOFFSET
#endif
#define HOFFSET(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
#endif

View File

@@ -0,0 +1,91 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5CPPDOC_H
#define _H5CPPDOC_H
//-------------------------------------------------------------------------
// The following section will be used to generate the 'Mainpage'
// and the 'Examples' for the RM.
// ------------------------------------------------------------------------
/*! \mainpage notitle
*
* \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://www.hdfgroup.org/HDF5/doc/index.html
*
* Because the HDF5 library maps very well to
* the object oriented design approach, classes in the C++ API can
* closely represent the interfaces of the HDF5 APIs, as followed:
*
* \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
\endverbatim
* \section install_sec Installation
*
* Please refer to the file release_docs/INSTALL_Windows.txt
* under the top directory for information about installing, building,
* and testing the C++ API.
*
*
*/
/// This example shows how to create datasets.
///\par
///\example create.cpp
///\par
/// This example shows how to write datasets.
///\example writedata.cpp
///\par
/// This example shows how to read datasets.
///\example readdata.cpp
///\par
/// This example shows how to create a compound datatype,
/// write an array which has the compound datatype to the file,
/// and read back fields' subsets.
///\example compound.cpp
///\par
/// This example shows how to work with extendible datasets.
///\example extend_ds.cpp
///\par
/// This example shows how to read data from a chunked dataset.
///\example chunks.cpp
///\par
/// This example shows how to work with groups.
///\example h5group.cpp
#endif

View File

@@ -0,0 +1,848 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5PropList.h"
#include "H5DxferProp.h"
#include "H5DcreatProp.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSpace.h"
#include "H5AbstractDs.h"
#include "H5File.h"
#include "H5Attribute.h"
#include "H5DataSet.h"
#include "H5private.h" // for HDfree
#ifndef H5_NO_NAMESPACE
namespace H5 {
#ifndef H5_NO_STD
using std::cerr;
using std::endl;
#endif // H5_NO_STD
#endif
//--------------------------------------------------------------------------
// Function: DataSet default constructor
///\brief Default constructor: creates a stub DataSet.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet() : AbstractDs(), H5Object(), id(0) {}
//--------------------------------------------------------------------------
// Function: DataSet overloaded constructor
///\brief Creates an DataSet object using the id of an existing dataset.
///\param existing_id - IN: Id of an existing dataset
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet(const hid_t existing_id) : AbstractDs(), H5Object()
{
id = existing_id;
}
//--------------------------------------------------------------------------
// Function: DataSet copy constructor
///\brief Copy constructor: makes a copy of the original DataSet object.
///\param original - IN: DataSet instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSet::DataSet(const DataSet& original) : AbstractDs(original), H5Object(original)
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
// Function: DataSet overload constructor - dereference
///\brief Given a reference, ref, to an hdf5 dataset, creates a
/// DataSet object
///\param obj - 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
///\exception H5::DataSetIException
///\par Description
/// \c obj 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()
{
try {
id = p_dereference(obj.getId(), ref, ref_type);
} catch (ReferenceException deref_error) {
throw ReferenceException("DataSet constructor - located by object",
deref_error.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// 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
/// 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
///\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()
{
try {
id = p_dereference(attr.getId(), ref, ref_type);
} catch (ReferenceException deref_error) {
throw ReferenceException("DataSet constructor - located by attribute",
deref_error.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: DataSet::getSpace
///\brief Gets a copy of the dataspace of this dataset.
///\return DataSpace instance
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace DataSet::getSpace() const
{
// Calls C function H5Dget_space to get the id of the dataspace
hid_t dataspace_id = H5Dget_space( id );
// If the dataspace id is invalid, throw an exception
if( dataspace_id < 0 )
{
throw DataSetIException("DataSet::getSpace", "H5Dget_space failed");
}
//create dataspace object using the existing id then return the object
DataSpace data_space( dataspace_id );
return( data_space );
}
// This private member function calls the C API to get the identifier
// of the datatype that is used by this dataset. It is used
// by the various AbstractDs functions to get the specific datatype.
hid_t DataSet::p_get_type() const
{
hid_t type_id = H5Dget_type( id );
if( type_id > 0 )
return( type_id );
else
{
throw DataSetIException("", "H5Dget_type failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::getCreatePlist
///\brief Gets the dataset creation property list.
///\return DSetCreatPropList instance
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList DataSet::getCreatePlist() const
{
hid_t create_plist_id = H5Dget_create_plist( id );
if( create_plist_id < 0 )
{
throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed");
}
// create and return the DSetCreatPropList object
DSetCreatPropList create_plist( create_plist_id );
return( create_plist );
}
//--------------------------------------------------------------------------
// Function: DataSet::getStorageSize
///\brief Returns the amount of storage required for a dataset.
///\return Size of the storage or 0, for no data
///\exception H5::DataSetIException
// Note: H5Dget_storage_size returns 0 when there is no data. This
// function should have no failure. (from SLU)
// Programmer Binh-Minh Ribler - Mar, 2005
//--------------------------------------------------------------------------
hsize_t DataSet::getStorageSize() const
{
hsize_t storage_size = H5Dget_storage_size(id);
return(storage_size);
}
//--------------------------------------------------------------------------
// Function: DataSet::getInMemDataSize
///\brief Gets the size in memory of the dataset's data.
///\return Size of data (in memory)
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - Apr 2009
//--------------------------------------------------------------------------
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.
///\return Address of dataset
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
haddr_t DataSet::getOffset() const
{
haddr_t ds_addr; // for address of dataset
ds_addr = H5Dget_offset(id);
if( ds_addr == HADDR_UNDEF )
{
throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF");
}
return(ds_addr);
}
//--------------------------------------------------------------------------
// Function: DataSet::getSpaceStatus
///\brief Determines whether space has been allocated for a dataset.
///\param status - OUT: Space allocation status
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::getSpaceStatus(H5D_space_status_t& status) const
{
herr_t ret_value = H5Dget_space_status(id, &status);
if( ret_value < 0 )
{
throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::getVlenBufSize
///\brief Returns the number of bytes required to store VL data.
///\return Amount of storage
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
hsize_t size; // for amount of storage
herr_t ret_value = H5Dvlen_get_buf_size( id, type_id, space_id, &size );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed");
}
return( size );
}
//--------------------------------------------------------------------------
// Function: DataSet::vlenReclaim
///\brief Reclaims VL datatype memory buffers.
///\param type - IN: Datatype, which is the datatype stored in the buffer
///\param space - IN: Selection for the memory buffer to free the
/// VL datatypes within
///\param xfer_plist - IN: Property list used to create the buffer
///\param buf - IN: Pointer to the buffer to be reclaimed
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf )
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dvlen_reclaim( type_id, space_id, xfer_plist_id, buf );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::vlenReclaim
///\brief Reclaims VL datatype memory buffers.
///\param type - IN: Datatype, which is the datatype stored in the buffer
///\param space - IN: Selection for the memory buffer to free the
/// VL datatypes within
///\param xfer_plist - IN: Property list used to create the buffer
///\param buf - IN: Pointer to the buffer to be reclaimed
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//\parDescription
// This function has better prototype for the users than the
// other, which might be removed at some point. BMR - 2006/12/20
//--------------------------------------------------------------------------
void DataSet::vlenReclaim(void* buf, const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist)
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dvlen_reclaim(type_id, space_id, xfer_plist_id, buf);
if (ret_value < 0)
{
throw DataSetIException("DataSet::vlenReclaim", "H5Dvlen_reclaim failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::read
///\brief Reads raw data from the specified dataset.
///\param buf - IN: Buffer for read data
///\param mem_type - IN: Memory datatype
///\param mem_space - IN: Memory dataspace
///\param file_space - IN: Dataset's dataspace in the file
///\param xfer_plist - IN: Transfer property list for this I/O operation
///\exception H5::DataSetIException
///\par Description
/// This function reads raw data from this dataset into the
/// buffer \a buf, converting from file datatype and dataspace
/// to memory datatype \a mem_type and dataspace \a mem_space.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::read( void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Obtain identifiers for C API
hid_t mem_type_id = mem_type.getId();
hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dread( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::read", "H5Dread failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::read
///\brief This is an overloaded member function, provided for convenience.
/// It takes a reference to a \c H5std_string for the buffer.
///\param buf - IN: Buffer for read data
///\param mem_type - IN: Memory datatype
///\param mem_space - IN: Memory dataspace
///\param file_space - IN: Dataset's dataspace in the file
///\param xfer_plist - IN: Transfer property list for this I/O operation
///\exception H5::DataSetIException
// 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
{
// 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");
}
// 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();
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);
}
}
//--------------------------------------------------------------------------
// Function: DataSet::write
///\brief Writes raw data from an application buffer to a dataset.
///\param buf - IN: Buffer containing data to be written
///\param mem_type - IN: Memory datatype
///\param mem_space - IN: Memory dataspace
///\param file_space - IN: Dataset's dataspace in the file
///\param xfer_plist - IN: Transfer property list for this I/O operation
///\exception H5::DataSetIException
///\par Description
/// This function writes raw data from an application buffer
/// \a buf to a dataset, converting from memory datatype
/// \a mem_type and dataspace \a mem_space to file datatype
/// and dataspace.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::write( const void* buf, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Obtain identifiers for C API
hid_t mem_type_id = mem_type.getId();
hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
herr_t ret_value = H5Dwrite( id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::write", "H5Dwrite failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::write
///\brief This is an overloaded member function, provided for convenience.
/// It takes a reference to a \c H5std_string for the buffer.
// Programmer Binh-Minh Ribler - 2000
// Modification
// Jul 2009
// Modified to pass the buffer into H5Dwrite properly depending
// whether the dataset has variable- or fixed-length string.
//--------------------------------------------------------------------------
void DataSet::write( const H5std_string& strg, const DataType& mem_type, const DataSpace& mem_space, const DataSpace& file_space, const DSetMemXferPropList& xfer_plist ) const
{
// Check if this attribute has variable-len string or fixed-len string and
// proceed appropriately.
htri_t is_variable_len = H5Tis_variable_str(mem_type.getId());
if (is_variable_len < 0)
{
throw DataSetIException("DataSet::write", "H5Tis_variable_str failed");
}
// Obtain identifiers for C API
hid_t mem_type_id = mem_type.getId();
hid_t mem_space_id = mem_space.getId();
hid_t file_space_id = file_space.getId();
hid_t xfer_plist_id = xfer_plist.getId();
// 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");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::iterateElems
///\brief Iterates over all selected elements in a dataspace.
///\param buf - IN/OUT: Pointer to the buffer in memory containing the
/// elements to iterate over
///\param type - IN: Datatype for the elements stored in \a buf
///\param space - IN: Dataspace for \a buf. Also contains the selection
/// to iterate over.
///\param op - IN: Function pointer to the routine to be called for
/// each element in \a buf iterated over
///\param op_data - IN/OUT: Pointer to any user-defined data associated
/// with the operation
///\exception H5::DataSetIException
///\note This function may not work correctly yet - it's still
/// under development.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DataSet::iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data )
{
// Obtain identifiers for C API
hid_t type_id = type.getId();
hid_t space_id = space.getId();
herr_t ret_value = H5Diterate( buf, type_id, space_id, op, op_data );
if( ret_value >= 0 )
return( ret_value );
else // raise exception when H5Diterate returns a negative value
{
throw DataSetIException("DataSet::iterateElems", "H5Diterate failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSet::extend
///\brief Extends a dataset with unlimited dimension.
///\param size - IN: Array containing the new magnitude of each dimension
///\exception H5::DataSetIException
///\par Description
/// For more information, please see the Description section in
/// C layer Reference Manual at:
///\par
/// 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
{
herr_t ret_value = H5Dset_extent( id, size );
if( ret_value < 0 ) // raise exception when H5Dset_extent returns a neg value
throw DataSetIException("DataSet::extend", "H5Dset_extent failed");
}
//--------------------------------------------------------------------------
// Function: DataSet::fillMemBuf
///\brief Fills a selection in memory with a value.
///\param fill - IN: Pointer to fill value to use - default NULL
///\param fill_type - IN: Datatype of the fill value
///\param buf - IN/OUT: Memory buffer to fill selection within
///\param buf_type - IN: Datatype of the elements in buffer
///\param space - IN: Dataspace describing memory buffer & containing selection to use
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space)
{
hid_t fill_type_id = fill_type.getId();
hid_t buf_type_id = buf_type.getId();
hid_t space_id = space.getId();
herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id);
if( ret_value < 0 )
{
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
//--------------------------------------------------------------------------
// 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.
///\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)
{
hid_t buf_type_id = buf_type.getId();
hid_t space_id = space.getId();
herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id);
if( ret_value < 0 )
{
throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed");
}
}
#ifndef H5_NO_DEPRECATED_SYMBOLS
//--------------------------------------------------------------------------
// Function: DataSet::getObjType
///\brief Retrieves the type of object that an object reference points to.
///\param ref_type - IN: Type of reference to query, valid values are:
/// \li \c H5R_OBJECT - Reference is an object reference.
/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference.
///\param ref - IN: Reference to query
///\return An object type, which can be one of the following:
/// \li \c H5G_LINK (0) - Object is a symbolic link.
/// \li \c H5G_GROUP (1) - Object is a group.
/// \li \c H5G_DATASET (2) - Object is a dataset.
/// \li \c H5G_TYPE (3) - Object is a named datatype
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
H5G_obj_t DataSet::getObjType(void *ref, H5R_type_t ref_type) const
{
try {
return(p_get_obj_type(ref, ref_type));
}
catch (IdComponentException E) {
throw DataSetIException("DataSet::getObjType", E.getDetailMsg());
}
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
//--------------------------------------------------------------------------
// Function: DataSet::getRegion
///\brief Retrieves a dataspace with the region pointed to selected.
///\param ref - IN: Reference to get region of
///\param ref_type - IN: Type of reference to get region of - default
/// to H5R_DATASET_REGION
///\return DataSpace instance
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
DataSpace DataSet::getRegion(void *ref, H5R_type_t ref_type) const
{
try {
DataSpace dataspace(p_get_region(ref, ref_type));
return(dataspace);
}
catch (IdComponentException E) {
throw DataSetIException("DataSet::getRegion", E.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: DataSet::getId
///\brief Get the id of this dataset.
// Description:
// Class hierarchy is revised to address bugzilla 1068. Class
// AbstractDs and Attribute are moved out of H5Object. In
// addition, member IdComponent::id is moved into subclasses, and
// IdComponent::getId now becomes pure virtual function.
// Programmer Binh-Minh Ribler - May, 2008
//--------------------------------------------------------------------------
hid_t DataSet::getId() const
{
return(id);
}
//--------------------------------------------------------------------------
// Function: DataSet::p_read_fixed_len (private)
// brief Reads a fixed 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_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 attr_size = getInMemDataSize();
// If there is data, allocate buffer and read it.
if (attr_size > 0)
{
char *strg_C = NULL;
strg_C = new char [(size_t)attr_size+1];
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);
}
//--------------------------------------------------------------------------
// Function: DataSet::p_setId (private)
///\brief Sets the identifier of this dataset to a new value.
///
///\exception H5::IdComponentException when the attempt to close the HDF5
/// object fails
// Description:
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSet::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
catch (Exception close_error) {
throw DataSetIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;
// increment the reference counter of the new id
//incRefCount();
}
//--------------------------------------------------------------------------
// Function: DataSet::close
///\brief Closes this dataset.
///
///\exception H5::DataSetIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void DataSet::close()
{
if (p_valid_id(id))
{
herr_t ret_value = H5Dclose( id );
if( ret_value < 0 )
{
throw DataSetIException("DataSet::close", "H5Dclose failed");
}
// reset the id
id = 0;
}
}
//--------------------------------------------------------------------------
// Function: DataSet destructor
///\brief Properly terminates access to this dataset.
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
DataSet::~DataSet()
{
try {
close();
}
catch (Exception close_error) {
cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl;
}
}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,132 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// Class DataSet inherits from AbstractDs and provides accesses to a dataset.
#ifndef _H5DataSet_H
#define _H5DataSet_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP DataSet : public H5Object, public AbstractDs {
public:
// Close this dataset.
virtual void close();
// Extends the dataset with unlimited dimension.
void extend( const hsize_t* size ) const;
// Fills a selection in memory with a value
void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space);
// Fills a selection in memory with zero
void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space);
// Gets the creation property list of this dataset.
DSetCreatPropList getCreatePlist() const;
// Returns the address of this dataset in the file.
haddr_t getOffset() const;
// Gets the dataspace of this dataset.
virtual DataSpace getSpace() const;
// Determines whether space has been allocated for a dataset.
void getSpaceStatus(H5D_space_status_t& status) const;
// Returns the amount of storage size required for this dataset.
virtual hsize_t getStorageSize() const;
// Returns the in memory size of this attribute's data.
virtual size_t getInMemDataSize() const;
// Returns the number of bytes required to store VL data.
hsize_t getVlenBufSize( DataType& type, DataSpace& space ) const;
// Reclaims VL datatype memory buffers.
static void vlenReclaim(const DataType& type, const DataSpace& space, const DSetMemXferPropList& xfer_plist, void* buf );
static void vlenReclaim(void *buf, const DataType& type, const DataSpace& space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT);
// Reads the data of this dataset and stores it in the provided buffer.
// The memory and file dataspaces and the transferring property list
// can be defaults.
void read( void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
void read( H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
// Writes the buffered data to this dataset.
// The memory and file dataspaces and the transferring property list
// can be defaults.
void write( const void* buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
void write( const H5std_string& buf, const DataType& mem_type, const DataSpace& mem_space = DataSpace::ALL, const DataSpace& file_space = DataSpace::ALL, const DSetMemXferPropList& xfer_plist = DSetMemXferPropList::DEFAULT ) const;
// Iterates the selected elements in the specified dataspace - not implemented in C++ style yet
int iterateElems( void* buf, const DataType& type, const DataSpace& space, H5D_operator_t op, void* op_data = NULL );
#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;
///\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);
// Default constructor.
DataSet();
// Copy constructor.
DataSet( const DataSet& original );
// Creates a copy of an existing DataSet using its id.
DataSet(const hid_t existing_id);
// Gets the dataset id.
virtual hid_t getId() const;
// Destructor: properly terminates access to this dataset.
virtual ~DataSet();
private:
hid_t id; // HDF5 dataset id
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// This function contains the common code that is used by
// getTypeClass and various API functions getXxxType
// defined in AbstractDs for generic datatype and specific
// sub-types
virtual hid_t p_get_type() const;
// Reads variable or fixed len strings from this dataset.
void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, const hid_t xfer_plist_id, H5std_string& strg) const;
protected:
// Sets the dataset id.
virtual void p_setId(const hid_t new_id);
#endif // DOXYGEN_SHOULD_SKIP_THIS
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,641 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5DataSpace.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#ifndef H5_NO_STD
using std::cerr;
using std::endl;
#endif // H5_NO_STD
#endif
//--------------------------------------------------------------------------
///\brief Constant for default dataspace.
//--------------------------------------------------------------------------
const DataSpace DataSpace::ALL( H5S_ALL );
//--------------------------------------------------------------------------
// Function: DataSpace constructor
///\brief Creates a new dataspace given a dataspace type.
///\param type - IN: Type of the dataspace to be created, which
/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE;
/// default to \c H5S_SCALAR.
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(H5S_class_t type) : IdComponent()
{
id = H5Screate( type );
if( id < 0 )
{
throw DataSpaceIException("DataSpace constructor", "H5Screate failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace overloaded constructor
///\brief Creates a new simple dataspace.
///\param rank - IN: Number of dimensions of dataspace.
///\param dims - IN: An array of the size of each dimension.
///\param maxdims - IN: An array of the maximum size of each dimension.
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) : IdComponent()
{
id = H5Screate_simple( rank, dims, maxdims );
if( id < 0 )
{
throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace overloaded constructor
///\brief Creates a DataSpace object using the id of an existing
/// dataspace.
///\param existing_id - IN: Id of an existing dataspace
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(const hid_t existing_id) : IdComponent()
{
id = existing_id;
}
//--------------------------------------------------------------------------
// Function: DataSpace copy constructor
///\brief Copy constructor: makes a copy of the original DataSpace object.
///\param original - IN: DataSpace object to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace::DataSpace(const DataSpace& original) : IdComponent(original)
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
// Function: DataSpace::copy
///\brief Makes a copy of an existing dataspace.
///\param like_space - IN: Dataspace to be copied
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
void DataSpace::copy( const DataSpace& like_space )
{
// If this object has an hdf5 valid id, close it
if( id != H5S_ALL ) {
try {
close();
}
catch (Exception close_error) {
throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg());
}
} // end if
// call C routine to copy the dataspace
id = H5Scopy( like_space.getId() );
if( id < 0 )
throw DataSpaceIException("DataSpace::copy", "H5Scopy failed");
}
//--------------------------------------------------------------------------
// Function: DataSpace::operator=
///\brief Assignment operator.
///\param rhs - IN: Reference to the existing dataspace
///\return Reference to DataSpace instance
///\exception H5::DataSpaceIException
// Description
// Makes a copy of the type on the right hand side and stores
// the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataSpace& DataSpace::operator=( const DataSpace& rhs )
{
if (this != &rhs)
copy(rhs);
return(*this);
}
//--------------------------------------------------------------------------
// Function: DataSpace::isSimple
///\brief Determines whether this dataspace is a simple dataspace.
///\return \c true if the dataspace is a simple dataspace, and \c false,
/// otherwise
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataSpace::isSimple () const
{
htri_t simple = H5Sis_simple( id );
if( simple > 0 )
return true;
else if( simple == 0 )
return false;
else
{
throw DataSpaceIException("DataSpace::isSimple",
"H5Sis_simple returns negative value");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::offsetSimple
///\brief Sets the offset of this simple dataspace.
///\param offset - IN: Offset to position the selection at
///\exception H5::DataSpaceIException
///\par Description
/// This function creates an offset for the selection within
/// an extent, allowing the same shaped selection to be moved
/// to different locations within a dataspace without requiring
/// it to be re-defined.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::offsetSimple ( const hssize_t* offset ) const
{
herr_t ret_value = H5Soffset_simple( id, offset );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSimpleExtentDims
///\brief Retrieves dataspace dimension size and maximum size.
///\param dims - IN: Name of the new member
///\param maxdims - IN: Pointer to the value of the new member
///\return Number of dimensions, the same value as returned by
/// \c DataSpace::getSimpleExtentNdims()
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DataSpace::getSimpleExtentDims ( hsize_t *dims, hsize_t *maxdims ) const
{
int ndims = H5Sget_simple_extent_dims( id, dims, maxdims );
if( ndims < 0 )
{
throw DataSpaceIException("DataSpace::getSimpleExtentDims",
"H5Sget_simple_extent_dims returns negative number of dimensions");
}
return( ndims );
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSimpleExtentNdims
///\brief Returns the dimensionality of a dataspace.
///\return Number of dimensions
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DataSpace::getSimpleExtentNdims () const
{
int ndims = H5Sget_simple_extent_ndims( id );
if( ndims < 0 )
{
throw DataSpaceIException("DataSpace::getSimpleExtentNdims",
"H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace");
}
return( ndims );
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSimpleExtentNpoints
///\brief Returns the number of elements in a dataspace.
///\return Number of elements
///\exception H5::DataSpaceIException
// Modification
// 12/05/00: due to C API change
// return type hssize_t vs. hsize_t
// num_elements = -1 when failure occurs vs. 0
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSimpleExtentNpoints () const
{
hssize_t num_elements = H5Sget_simple_extent_npoints( id );
if( num_elements > -1 )
return( num_elements );
else
{
throw DataSpaceIException("DataSpace::getSimpleExtentNpoints",
"H5Sget_simple_extent_npoints returns negative value for the number of elements in the dataspace");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSimpleExtentType
///\brief Returns the current class of a dataspace.
///\return Class of the dataspace
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5S_class_t DataSpace::getSimpleExtentType () const
{
H5S_class_t class_name = H5Sget_simple_extent_type( id );
if( class_name == H5S_NO_CLASS )
{
throw DataSpaceIException("DataSpace::getSimpleExtentType",
"H5Sget_simple_extent_type returns H5S_NO_CLASS");
}
return( class_name );
}
//--------------------------------------------------------------------------
// Function: DataSpace::extentCopy
///\brief Copies the extent of a dataspace.
///\param dest_space - IN: Dataspace to copy from
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::extentCopy ( DataSpace& dest_space ) const
{
hid_t dest_space_id = dest_space.getId();
herr_t ret_value = H5Sextent_copy( dest_space_id, id );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::setExtentSimple
///\brief Sets or resets the size of an existing dataspace.
///\param rank - IN: Rank of the dataspace
///\param current_size - IN: Array containing current size of dataspace
///\param maximum_size - IN: Array containing maximum size of dataspace
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size ) const
{
herr_t ret_value;
ret_value = H5Sset_extent_simple( id, rank, current_size, maximum_size );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::setExtentNone
///\brief Removes the extent from a dataspace.
///
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::setExtentNone () const
{
herr_t ret_value = H5Sset_extent_none( id );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSelectNpoints
///\brief Returns the number of elements in a dataspace selection.
///\return Number of elements
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectNpoints () const
{
hssize_t num_elements = H5Sget_select_npoints( id );
if( num_elements < 0 )
{
throw DataSpaceIException("DataSpace::getSelectNpoints",
"H5Sget_select_npoints returns negative value for number of elements in the dataspace selection");
}
return( num_elements );
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSelectHyperNblocks
///\brief Returns number of hyperslab blocks.
///\return Number of hyperslab blocks
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectHyperNblocks () const
{
hssize_t num_blocks = H5Sget_select_hyper_nblocks( id );
if( num_blocks < 0 )
{
throw DataSpaceIException("DataSpace::getSelectHyperNblocks",
"H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks");
}
return( num_blocks );
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSelectHyperBlocklist
///\brief Gets the list of hyperslab blocks currently selected
///\param startblock - IN: Hyperslab block to start with
///\param numblocks - IN: Number of hyperslab blocks to get
///\param buf - IN: List of hyperslab blocks selected
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const
{
herr_t ret_value;
ret_value = H5Sget_select_hyper_blocklist( id, startblock, numblocks, buf );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::getSelectHyperBlocklist",
"H5Sget_select_hyper_blocklist failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSelectElemNpoints
///\brief Returns the number of element points in the current selection.
///\return Number of element points
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
hssize_t DataSpace::getSelectElemNpoints () const
{
hssize_t num_points = H5Sget_select_elem_npoints( id );
if( num_points < 0 )
{
throw DataSpaceIException("DataSpace::getSelectElemNpoints",
"H5Sget_select_elem_npoints failed");
}
return( num_points );
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSelectElemPointlist
///\brief Gets the list of element points currently selected
///\param startpoint - IN: Element point to start with
///\param numpoints - IN: Number of element points to get
///\param buf - IN: List of element points selected
///\exception H5::DataSpaceIException
///\par Description
/// For more information, please refer to the C layer Reference
/// Manual at:
/// 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
{
herr_t ret_value;
ret_value = H5Sget_select_elem_pointlist( id, startpoint, numpoints, buf );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::getSelectElemPointlist",
"H5Sget_select_elem_pointlist failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::getSelectBounds
///\brief Gets the bounding box containing the current selection.
///\param start - IN: Starting coordinates of the bounding box
///\param end - IN: Ending coordinates of the bounding box, i.e.,
/// the coordinates of the diagonally opposite corner
///\exception H5::DataSpaceIException
///\par Description
/// For more information, please refer to the C layer Reference
/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectBounds
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const
{
herr_t ret_value = H5Sget_select_bounds( id, start, end );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::getSelectBounds",
"H5Sget_select_bounds failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::H5Sselect_elements
///\brief Selects array elements to be included in the selection for
/// this dataspace.
///\param op - IN: Operator specifying how the new selection is to be
/// combined with the existing selection for the dataspace
///\param num_elements - IN: Number of elements to be selected
///\param coord - IN: A 2-dimensional array of 0-based values
/// specifying the coordinates of the elements being selected
///\exception H5::DataSpaceIException
///\par Description
/// For more information, please refer to the C layer Reference
/// Manual at:
/// 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
{
herr_t ret_value;
ret_value = H5Sselect_elements( id, op, num_elements, coord );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::selectElements",
"H5Sselect_elements failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::selectAll
///\brief Selects the entire dataspace.
///
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectAll () const
{
herr_t ret_value = H5Sselect_all( id );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::selectNone
///\brief Resets the selection region to include no elements.
///
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectNone () const
{
herr_t ret_value = H5Sselect_none( id );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::selectNone",
"H5Sselect_none failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::selectValid
///\brief Verifies that the selection is within the extent of the
/// dataspace.
///\return \c true if the selection is within the extent of the
/// dataspace, and \c false, otherwise
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataSpace::selectValid () const
{
htri_t ret_value = H5Sselect_valid( id );
if( ret_value > 0 )
return true;
else if( ret_value == 0 )
return false;
else
{
throw DataSpaceIException("DataSpace::selectValid",
"H5Sselect_valid returns negative value");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::selectHyperslab
///\brief Selects a hyperslab region to add to the current selected region.
///\param op - IN: Operation to perform on current selection
///\param count - IN: Number of blocks included in the hyperslab
///\param start - IN: Offset of the start of hyperslab
///\param stride - IN: Hyperslab stride - default to \c NULL
///\param block - IN: Size of block in the hyperslab - default to \c NULL
///\exception H5::DataSpaceIException
///\par Description
/// For more information, please refer to the C layer Reference
/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5S.html#Dataspace-SelectHyperslab
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block ) const
{
herr_t ret_value;
ret_value = H5Sselect_hyperslab( id, op, start, stride, count, block );
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::selectHyperslab",
"H5Sselect_hyperslab failed");
}
}
//--------------------------------------------------------------------------
// Function: DataSpace::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
//--------------------------------------------------------------------------
hid_t DataSpace::getId() const
{
return(id);
}
//--------------------------------------------------------------------------
// Function: DataSpace::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
// Description:
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataSpace::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
catch (Exception close_error) {
throw DataSpaceIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;
}
//--------------------------------------------------------------------------
// Function: DataSpace::close
///\brief Closes this dataspace.
///
///\exception H5::DataSpaceIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void DataSpace::close()
{
// check if id is a valid hdf5 object id before trying to close it
if (p_valid_id(id))
{
herr_t ret_value = H5Sclose(id);
if( ret_value < 0 )
{
throw DataSpaceIException("DataSpace::close", "H5Sclose failed");
}
// reset the id
id = 0;
}
}
//--------------------------------------------------------------------------
// Function: DataSpace destructor
///\brief Properly terminates access to this dataspace.
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
DataSpace::~DataSpace()
{
try {
close();
} catch (Exception close_error) {
cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl;
}
}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,131 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5DataSpace_H
#define _H5DataSpace_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP DataSpace : public IdComponent {
public:
// Default DataSpace objects
static const DataSpace ALL;
// Creates a dataspace object given the space type
DataSpace(H5S_class_t type = H5S_SCALAR);
// Creates a simple dataspace
DataSpace(int rank, const hsize_t * dims, const hsize_t * maxdims = NULL);
// Assignment operator
DataSpace& operator=( const DataSpace& rhs );
// Closes this dataspace.
virtual void close();
// Makes copy of an existing dataspace.
void copy(const DataSpace& like_space);
// Copies the extent of this dataspace.
void extentCopy( DataSpace& dest_space ) const;
// Gets the bounding box containing the current selection.
void getSelectBounds( hsize_t* start, hsize_t* end ) const;
// Gets the number of element points in the current selection.
hssize_t getSelectElemNpoints() const;
// Retrieves the list of element points currently selected.
void getSelectElemPointlist( hsize_t startpoint, hsize_t numpoints, hsize_t *buf ) const;
// Gets the list of hyperslab blocks currently selected.
void getSelectHyperBlocklist( hsize_t startblock, hsize_t numblocks, hsize_t *buf ) const;
// Get number of hyperslab blocks.
hssize_t getSelectHyperNblocks() const;
// Gets the number of elements in this dataspace selection.
hssize_t getSelectNpoints() const;
// Retrieves dataspace dimension size and maximum size.
int getSimpleExtentDims( hsize_t *dims, hsize_t *maxdims = NULL ) const;
// Gets the dimensionality of this dataspace.
int getSimpleExtentNdims() const;
// Gets the number of elements in this dataspace.
// 12/05/00 - changed return type to hssize_t from hsize_t - C API
hssize_t getSimpleExtentNpoints() const;
// Gets the current class of this dataspace.
H5S_class_t getSimpleExtentType() const;
// Determines if this dataspace is a simple one.
bool isSimple() const;
// Sets the offset of this simple dataspace.
void offsetSimple( const hssize_t* offset ) const;
// Selects the entire dataspace.
void selectAll() const;
// Selects array elements to be included in the selection for
// this dataspace.
void selectElements( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const;
// Selects a hyperslab region to add to the current selected region.
void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const;
// Resets the selection region to include no elements.
void selectNone() const;
// Verifies that the selection is within the extent of the dataspace.
bool selectValid() const;
// Removes the extent from this dataspace.
void setExtentNone() const;
// Sets or resets the size of this dataspace.
void setExtentSimple( int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL ) const;
///\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();
private:
hid_t id; // HDF5 dataspace id
protected:
// Sets the dataspace id.
virtual void p_setId(const hid_t new_id);
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,825 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DataSpace.h"
#include "H5Object.h"
#include "H5FaccProp.h"
#include "H5FcreatProp.h"
#include "H5DcreatProp.h"
#include "H5DxferProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5AtomType.h"
#include "H5PredType.h"
#include "H5private.h"
#include "H5AbstractDs.h"
#include "H5DataSet.h"
#include "H5File.h"
#include "H5Attribute.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#ifndef H5_NO_STD
using std::cerr;
using std::endl;
#endif // H5_NO_STD
#endif
//--------------------------------------------------------------------------
// Function: DataType overloaded constructor
///\brief Creates a datatype using an existing datatype's id
///\param existing_id - IN: Id of the existing datatype
// Description
// Constructor creates a copy of an existing DataType using
// its id.
// Programmer Binh-Minh Ribler - 2000
// 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;
}
//--------------------------------------------------------------------------
// Function: DataType overloaded constructor
///\brief Creates a object given its class and size
///\param type_class - IN: Class of datatype to create
///\param size - IN: Number of bytes in the datatype to create
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType::DataType( const H5T_class_t type_class, size_t size ) : H5Object()
{
// Call C routine to create the new datatype
id = H5Tcreate( type_class, size );
if( id < 0 )
{
throw DataTypeIException("DataType constructor", "H5Tcreate failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType overload constructor - dereference
///\brief Given a reference, ref, to an hdf5 group, creates a
/// DataType object
///\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 ref - IN: Reference pointer
///\param ref_type - IN: Reference type - default to H5R_OBJECT
///\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()
{
try {
id = p_dereference(h5file.getId(), ref, ref_type);
} catch (ReferenceException deref_error) {
throw ReferenceException("DataType constructor - located by an H5File",
deref_error.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// Function: DataType overload constructor - dereference
///\brief Given a reference, ref, to an hdf5 group, creates a
/// DataType object
///\param attr - IN: Specifying location where the referenced object is in
///\param ref - IN: Reference pointer
///\param ref_type - IN: Reference type - default to H5R_OBJECT
///\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()
{
try {
id = p_dereference(attr.getId(), ref, ref_type);
} catch (ReferenceException deref_error) {
throw ReferenceException("DataType constructor - located by an Attribute",
deref_error.getDetailMsg());
}
}
//--------------------------------------------------------------------------
// 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)
{
id = original.getId();
incRefCount(); // increment number of references to this id
}
//--------------------------------------------------------------------------
// Function: DataType::copy
///\brief Copies an existing datatype to this datatype object
///\param like_type - IN: Datatype to be copied
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
//--------------------------------------------------------------------------
void DataType::copy( const DataType& like_type )
{
// close the current data type before copying like_type to this object
try {
close();
}
catch (Exception close_error) {
throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
// call C routine to copy the datatype
id = H5Tcopy( like_type.getId() );
if( id < 0 )
throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
}
//--------------------------------------------------------------------------
// Function: DataType::copy
///\brief Copies the datatype of the given dataset to this datatype object
///\param dset - IN: Dataset
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jan, 2007
///\par Description
/// The resulted dataset will be transient and modifiable.
//--------------------------------------------------------------------------
void DataType::copy(const DataSet& dset)
{
// close the current data type before copying dset's datatype to this object
try {
close();
}
catch (Exception close_error) {
throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg());
}
// call C routine to copy the datatype
id = H5Tcopy( dset.getId() );
if( id < 0 )
throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed");
}
//--------------------------------------------------------------------------
// Function: DataType::operator=
///\brief Assignment operator
///\param rhs - IN: Reference to the existing datatype
///\return Reference to DataType instance
///\exception H5::DataTypeIException
// Description
// Makes a copy of the type on the right hand side and stores
// the new id in the left hand side object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType& DataType::operator=( const DataType& rhs )
{
if (this != &rhs)
copy(rhs);
return(*this);
}
//--------------------------------------------------------------------------
// Function: DataType::operator==
///\brief Compares this DataType against the given one to determines
/// whether the two objects refer to the same actual datatype.
///\param compared_type - IN: Reference to the datatype to compare
///\return true if the datatypes are equal, and false, otherwise.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataType::operator==(const DataType& compared_type ) const
{
// Call C routine H5Tequal to determines whether two datatype
// identifiers refer to the same datatype
htri_t ret_value = H5Tequal( id, compared_type.getId() );
if( ret_value > 0 )
return true;
else if( ret_value == 0 )
return false;
else
{
throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value");
}
}
//--------------------------------------------------------------------------
// Function: DataType::p_commit (private)
//\brief Commits a transient datatype to a file, creating a new
// named datatype
//\param loc_id - IN: The id of either a file, group, dataset, named
// datatype, or attribute.
//\param name - IN: Name of the datatype
//\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
// Modification:
// Copied from DataType::commit and made into private function
// to be commonly used by several overloads of DataType::commit.
// BMR - Jan, 2007
//--------------------------------------------------------------------------
void DataType::p_commit(hid_t loc_id, const char* name)
{
// Call C routine to commit the transient datatype
herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if( ret_value < 0 )
throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed");
}
//--------------------------------------------------------------------------
// 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 name - IN: Name of the datatype
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
void DataType::commit(H5Object& loc, const char* name)
{
p_commit(loc.getId(), 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(H5Object& loc, const H5std_string& name)
{
p_commit(loc.getId(), name.c_str());
}
//--------------------------------------------------------------------------
// Function: DataType::committed
///\brief Determines whether a datatype is a named type or a
/// transient type.
///\return \c true if the datatype is a named type, and \c false,
/// otherwise.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DataType::committed() const
{
// Call C function to determine if a datatype is a named one
htri_t committed = H5Tcommitted( id );
if( committed > 0 )
return true;
else if( committed == 0 )
return false;
else
{
throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value");
}
}
//--------------------------------------------------------------------------
// Function: DataType::find
///\brief Finds a conversion function that can handle a conversion
/// from this datatype to the specified datatype, \a dest.
///\param dest - IN: Destination datatype
///\param pcdata - IN: Pointer to type conversion data
///\return Pointer to a suitable conversion function
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_conv_t DataType::find( const DataType& dest, H5T_cdata_t **pcdata ) const
{
// Call C routine to find the conversion function
H5T_conv_t func = H5Tfind( id, dest.getId(), pcdata );
if( func == NULL )
{
throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function");
}
return( func );
}
//--------------------------------------------------------------------------
// Function: DataType::convert
///\brief Converts data from this datatype to the specified datatypes.
///\param dest - IN: Destination datatype
///\param nelmts - IN: Size of array \a buf
///\param buf - IN/OUT: Array containing pre- and post-conversion
/// values
///\param background - IN: Optional backgroud buffer
///\param plist - IN: Dataset transfer property list
///\return Pointer to a suitable conversion function
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist ) const
{
// Get identifiers for C API
hid_t dest_id = dest.getId();
hid_t plist_id = plist.getId();
// Call C routine H5Tconvert to convert the data
herr_t ret_value;
ret_value = H5Tconvert( id, dest_id, nelmts, buf, background, plist_id );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType::lock
///\brief Locks a datatype, making it read-only and non-destructible.
///
///\exception H5::DataTypeIException
///\par Descrition
/// This is normally done by the library for predefined data
/// types so the application doesn't inadvertently change or
/// delete a predefined type.
///
/// Once a data type is locked it can never be unlocked unless
/// the entire library is closed.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::lock() const
{
// Call C routine to lock the datatype
herr_t ret_value = H5Tlock( id );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType::getClass
///\brief Returns the datatype class identifier.
///\return Datatype class identifier
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5T_class_t DataType::getClass() const
{
H5T_class_t type_class = H5Tget_class( id );
// Return datatype class identifier if successful
if( type_class == H5T_NO_CLASS )
{
throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS");
}
return( type_class );
}
//--------------------------------------------------------------------------
// Function: DataType::getSize
///\brief Returns the size of a datatype.
///\return Datatype size in bytes
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
size_t DataType::getSize() const
{
// Call C routine to get the datatype size
size_t type_size = H5Tget_size( id );
if( type_size <= 0 ) // valid data types are never zero size
{
throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size");
}
return( type_size );
}
//--------------------------------------------------------------------------
// Function: DataType::getSuper
///\brief Returns the base datatype from which a datatype is derived.
///\return DataType object
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DataType DataType::getSuper() const
{
// Call C routine to get the base datatype from which the specified
// datatype is derived.
hid_t base_type_id = H5Tget_super( id );
// If H5Tget_super returns a valid datatype id, create and return
// the base type, otherwise, raise exception
if( base_type_id > 0 )
{
DataType base_type( base_type_id );
return( base_type );
}
else
{
throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType::registerFunc
///\brief Registers the specified conversion function.
///\param pers - IN: Conversion option
/// \li \c H5T_PERS_HARD for hard conversion functions
/// \li \c H5T_PERS_SOFT for soft conversion functions.
///\param name - IN: Name displayed in diagnostic output.
///\param dest - IN: Destination datatype.
///\param func - IN: Function to convert between source and
/// destination datatypes.
///\exception H5::DataTypeIException
///\par Description
/// For more information, please see:
/// 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
{
hid_t dest_id = dest.getId(); // get id of the destination datatype
// Call C routine H5Tregister to register the conversion function
herr_t ret_value = H5Tregister( pers, name, id, dest_id, func );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType::registerFunc
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in the type of the
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::registerFunc( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const
{
registerFunc( pers, name.c_str(), dest, func );
}
//--------------------------------------------------------------------------
// Function: DataType::unregister
///\brief Removes a conversion function from all conversion paths.
///\param pers - IN: Conversion option
/// \li \c H5T_PERS_HARD for hard conversion functions
/// \li \c H5T_PERS_SOFT for soft conversion functions.
///\param name - IN: Name displayed in diagnostic output.
///\param dest - IN: Destination datatype.
///\param func - IN: Function to convert between source and
/// destination datatypes.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const
{
hid_t dest_id = dest.getId(); // get id of the dest datatype for C API
// Call C routine H5Tunregister to remove the conversion function
herr_t ret_value = H5Tunregister( pers, name, id, dest_id, func );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType::unregister
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in the type of the
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const
{
unregister( pers, name.c_str(), dest, func );
}
//--------------------------------------------------------------------------
// Function: DataType::setTag
///\brief Tags an opaque datatype.
///\param tag - IN: Descriptive ASCII string with which the opaque
/// datatype is to be tagged.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::setTag( const char* tag ) const
{
// Call C routine H5Tset_tag to tag an opaque datatype.
herr_t ret_value = H5Tset_tag( id, tag );
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed");
}
}
//--------------------------------------------------------------------------
// Function: DataType::setTag
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in the type of the
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::setTag( const H5std_string& tag ) const
{
setTag( tag.c_str());
}
//--------------------------------------------------------------------------
// Function: DataType::getTag
///\brief Gets the tag associated with an opaque datatype.
///\return Tag associated with the opaque datatype
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string DataType::getTag() const
{
char* tag_Cstr = H5Tget_tag( id );
// if the tag C-string returned is not NULL, convert it to C++ string
// and return it, otherwise, raise an exception
if( tag_Cstr != NULL )
{
H5std_string tag = H5std_string(tag_Cstr); // C string to string object
HDfree(tag_Cstr); // free the C string
return (tag); // return the tag
}
else
{
throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag");
}
}
//--------------------------------------------------------------------------
// Function: DataType::detectClass
///\brief Checks whether a datatype contains (or is) a certain type of
/// datatype.
///\return true if this datatype contains or is the specified type,
/// and false, otherwise.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
bool DataType::detectClass(H5T_class_t cls) const
{
htri_t ret_value = H5Tdetect_class(id, cls);
if( ret_value > 0 )
return true;
else if( ret_value == 0 )
return false;
else
{
throw DataTypeIException(inMemFunc("detectClass"),
"H5Tdetect_class returns negative value");
}
}
//--------------------------------------------------------------------------
// Function: DataType::isVariableStr
///\brief Check whether this datatype is a variable-length string.
///\return true if this datatype is a variable-length string, and
/// false, otherwise.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
bool DataType::isVariableStr() const
{
htri_t is_varlen_str = H5Tis_variable_str(id);
if( is_varlen_str == 1 )
return true;
else if( is_varlen_str == 0 )
return false;
else
{
throw DataTypeIException(inMemFunc("isVariableStr"),
"H5Tis_variable_str returns negative value");
}
}
#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
// 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
//--------------------------------------------------------------------------
hid_t DataType::getId() const
{
return(id);
}
//--------------------------------------------------------------------------
// Function: DataType::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
// Description:
// The underlaying reference counting in the C library ensures
// that the current valid id of this object is properly closed.
// Then the object's id is reset to the new id.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DataType::p_setId(const hid_t new_id)
{
// handling references to this old id
try {
close();
}
catch (Exception close_error) {
throw DataTypeIException(inMemFunc("p_setId"), close_error.getDetailMsg());
}
// reset object's id to the given id
id = new_id;
}
//--------------------------------------------------------------------------
// Function: DataType::close
///\brief Closes the datatype if it is not a predefined type.
///
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - Mar 9, 2005
//--------------------------------------------------------------------------
void DataType::close()
{
if (p_valid_id(id))
{
herr_t ret_value = H5Tclose(id);
if( ret_value < 0 )
{
throw DataTypeIException(inMemFunc("close"), "H5Tclose failed");
}
// reset the id
id = 0;
}
}
//--------------------------------------------------------------------------
// Function: DataType destructor
///\brief Properly terminates access to this datatype.
// Programmer Binh-Minh Ribler - 2000
// Modification
// - Replaced resetIdComponent() with decRefCount() to use C
// library ID reference counting mechanism - BMR, Jun 1, 2004
// - Replaced decRefCount with close() to let the C library
// handle the reference counting - BMR, Jun 1, 2006
// - Added the use of H5CPP_EXITED to terminate the HDF5 library
// and elimiate previous memory leaks. See comments in the
// header file "H5PredType.h" for details. - BMR, Mar 30, 2012
//--------------------------------------------------------------------------
DataType::~DataType()
{
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
#endif

View File

@@ -0,0 +1,139 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5DataType_H
#define _H5DataType_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP DataType : public H5Object {
public:
// Creates a datatype given its class and size
DataType( const H5T_class_t type_class, size_t size );
// Copy constructor: makes a copy of the original object
DataType( const DataType& original );
// 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);
// Closes this datatype.
virtual void close();
// Copies an existing datatype to this datatype object.
void copy(const DataType& like_type);
// Copies the datatype of dset to this datatype object.
void copy(const DataSet& dset);
// Returns the datatype class identifier.
H5T_class_t getClass() const;
// Commits a transient datatype to a file; this datatype becomes
// a named datatype which can be accessed from the location.
void commit( 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);
// Determines whether this datatype is a named datatype or
// a transient datatype.
bool committed() const;
// Finds a conversion function that can handle the conversion
// this datatype to the given datatype, dest.
H5T_conv_t find( const DataType& dest, H5T_cdata_t **pcdata ) const;
// Converts data from between specified datatypes.
void convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const;
// Assignment operator
DataType& operator=( const DataType& rhs );
// Determines whether two datatypes are the same.
bool operator==(const DataType& compared_type ) const;
// Locks a datatype.
void lock() const;
// Returns the size of a datatype.
size_t getSize() const;
// Returns the base datatype from which a datatype is derived.
// Note: not quite right for specific types yet???
DataType getSuper() const;
// Registers a conversion function.
void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const;
void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const;
// Removes a conversion function from all conversion paths.
void unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const;
void unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const;
// Tags an opaque datatype.
void setTag( const char* tag ) const;
void setTag( const H5std_string& tag ) const;
// Gets the tag associated with an opaque datatype.
H5std_string getTag() const;
// Checks whether this datatype contains (or is) a certain type class.
bool detectClass(H5T_class_t cls) const;
// Checks whether this datatype is a variable-length string.
bool isVariableStr() const;
#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;
///\brief Returns this class name
virtual H5std_string fromClass () const { return("DataType"); }
// Creates a copy of an existing DataType using its id
DataType( const hid_t type_id );
// Default constructor
DataType();
// Gets the datatype id.
virtual hid_t getId() const;
// Destructor: properly terminates access to this datatype.
virtual ~DataType();
protected:
hid_t id; // HDF5 datatype id
// Sets the datatype id.
virtual void p_setId(const hid_t new_id);
private:
void p_commit(hid_t loc_id, const char* name);
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,673 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
//--------------------------------------------------------------------------
///\brief Constant for dataset creation default property
//--------------------------------------------------------------------------
const DSetCreatPropList DSetCreatPropList::DEFAULT;
//--------------------------------------------------------------------------
// Function: DSetCreatPropList default constructor
///\brief Default constructor: creates a stub dataset creation property list
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList::DSetCreatPropList() : PropList( H5P_DATASET_CREATE) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList copy constructor
///\brief Copy constructor: makes a copy of the original
/// DSetCreatPropList object
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList::DSetCreatPropList( const DSetCreatPropList& orig ) : PropList( orig ) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList overloaded constructor
///\brief Creates a DSetCreatPropList object using the id of an
/// existing dataset creation property list.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setChunk
///\brief Sets the size of the chunks used to store a chunked layout
/// dataset.
///\param ndims - IN: Number of dimensions of each chunk
///\param dim - IN: Array containing the size of each chunk
///\exception H5::PropListIException
///\par Description
/// The \a ndims parameter currently must have the same value as
/// the rank of the dataset. The values of the \a dim array
/// define the size of the chunks to store the dataset's raw
/// data. As a side-effect, the layout of the dataset will be
/// changed to \c H5D_CHUNKED, if it is not so already.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setChunk( int ndims, const hsize_t* dim ) const
{
herr_t ret_value = H5Pset_chunk( id, ndims, dim );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getChunk
///\brief Retrieves the size of the chunks used to store a chunked
/// layout dataset.
///\param max_ndims - IN: Size of \a dim array
///\param dim - OUT: Array to store the chunk dimensions
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DSetCreatPropList::getChunk( int max_ndims, hsize_t* dim ) const
{
int chunk_size = H5Pget_chunk( id, max_ndims, dim );
if( chunk_size < 0 )
{
throw PropListIException("DSetCreatPropList::getChunk",
"H5Pget_chunk returns negative chunk size");
}
return( chunk_size );
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setLayout
///\brief Sets the type of storage used store the raw data for a dataset.
///\param layout - IN: Type of storage layout for raw data
///\exception H5::PropListIException
///\par Description
/// For information on valid layout types, please refer to
/// 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
{
herr_t ret_value = H5Pset_layout( id, layout );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setLayout",
"H5Pset_layout failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getLayout
///\brief Retrieves the layout type of this property list
///\return Layout type, which can be:
/// \li \c H5D_COMPACT - raw data is stored in the object
/// header in the file.
/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the
/// object header in one contiguous chunk in
/// the file.
/// \li \c H5D_CHUNKED - raw data is stored separately from the
/// object header in chunks in separate locations
/// in the file.
///\exception H5::PropListIException
///\par Description
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_layout_t DSetCreatPropList::getLayout() const
{
H5D_layout_t layout = H5Pget_layout( id );
if( layout == H5D_LAYOUT_ERROR )
{
throw PropListIException("DSetCreatPropList::getLayout",
"H5Pget_layout returns H5D_LAYOUT_ERROR");
}
return( layout );
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setDeflate
///\brief Sets compression method and compression level
///\param level - IN: Compression level, should [0..9], inclusive
///\exception H5::PropListIException
///\par Description
/// The function sets the compression method for this property
/// list to \c H5D_COMPRESS_DEFLATE and the compression level to
/// \a level. Lower compression levels are faster but result in
/// less compression.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setDeflate( int level ) const
{
herr_t ret_value = H5Pset_deflate( id, level );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setDeflate",
"H5Pset_deflate failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setSzip
///\brief Sets up for the use of the SZIP compression filter.
///\param options_mask - IN: A bit-mask conveying the desired SZIP
/// options. Valid values are H5_SZIP_EC_OPTION_MASK
/// and H5_SZIP_NN_OPTION_MASK.
///\param pixels_per_block - IN: Number of pixels or data elements in
/// each data block.
///\exception H5::PropListIException
///\par Description
/// The associate C function sets an SZIP compression filter,
/// H5Z_FILTER_SZIP, for a dataset. For more information about
/// SZIP and usage, please refer to the C layer Reference
/// Manual at:
/// http://hdfgroup.org/HDF5/doc/RM_H5P.html#Property-SetSzip
// Programmer Binh-Minh Ribler - Jan, 2007
//--------------------------------------------------------------------------
void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const
{
herr_t ret_value = H5Pset_szip(id, options_mask, pixels_per_block);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setSzip",
"H5Pset_szip failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setFillValue
///\brief Sets a dataset fill value
///\param fvalue_type - IN: Data type for the value passed via \a value
///\param value - IN: Pointer to buffer containing the fill value
///\exception H5::PropListIException
///\par Description
/// The datatype may differ from that of the dataset, but it must
/// be one that the HDF5 library is able to convert \a value to
/// the dataset datatype when the dataset is created.
/// The default fill value is 0 (zero,) which is interpreted
/// according to the actual dataset datatype.
///\par
/// For information on setting fill value, please refer to the
/// C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetFillValue
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFillValue( const DataType& fvalue_type, const void* value ) const
{
herr_t ret_value = H5Pset_fill_value( id, fvalue_type.getId(), value );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setFillValue",
"H5Pset_fill_value failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getFillValue
///\brief Retrieves a dataset fill value
///\param fvalue_type - IN: Data type for the value passed via \a value
///\param value - OUT: Pointer to buffer to hold the retrieved fill value
///\exception H5::PropListIException
///\par Description
/// The fill value is returned through \a value pointer
/// and the memory is allocated by the caller. The fill
/// value will be converted from its current data type to the
/// specified by \a fvalue_type.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::getFillValue( const DataType& fvalue_type, void* value ) const
{
herr_t ret_value = H5Pget_fill_value( id, fvalue_type.getId(), value );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::getFillValue",
"H5Pget_fill_value failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::isFillValueDefined
///\brief Check if fill value has been defined for this property
///\return
/// \li \c H5D_FILL_VALUE_UNDEFINED =0,
/// \li \c H5D_FILL_VALUE_DEFAULT =1,
/// \li \c H5D_FILL_VALUE_USER_DEFINED =2
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_fill_value_t DSetCreatPropList::isFillValueDefined()
{
H5D_fill_value_t status;
herr_t ret_value = H5Pfill_value_defined(id, &status);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::isFillValueDefined",
"H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)");
}
else
return (status);
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setFilter
///\brief Adds a filter to the filter pipeline
///\param filter_id - IN: Filter to add
///\param flags - IN: Specifies general properties of the filter
///\param cd_nelmts - IN: Number of elements in cd_values
///\param cd_values - IN: Auxiliary data for the filter
///\exception H5::PropListIException
///\par Description
/// The \a flags argument is a bit vector of the field:
/// \c H5Z_FLAG_OPTIONAL(0x0001)
///\par
/// If this bit is set then the filter is optional. If the filter
/// fails during a \c DataSet::write() operation then the filter
/// is just excluded from the pipeline for the chunk for which it
/// failed; the filter will not participate in the pipeline
/// during a \c DataSet::read() of the chunk. If this bit is clear
/// and the filter fails then the entire I/O operation fails.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFilter( H5Z_filter_t filter_id, unsigned int flags,
size_t cd_nelmts, const unsigned int cd_values[] ) const
{
herr_t ret_value = H5Pset_filter( id, filter_id, flags, cd_nelmts, cd_values );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setFilter",
"H5Pset_filter failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::removeFilter
///\brief Removes one or more filters
///\param filter_id - IN: Filter to remove
///\exception H5::PropListIException
///\par Description
/// Deletes a filter from the dataset creation property list;
/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const
{
herr_t ret_value = H5Premove_filter( id, filter_id);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::removeFilter",
"H5Premove_filter failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getNfilters
///\brief Returns the number of filters in the pipeline
///\return Number of filters
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DSetCreatPropList::getNfilters() const
{
int num_filters = H5Pget_nfilters( id );
if( num_filters < 0 )
{
throw PropListIException("DSetCreatPropList::getNfilters",
"H5Pget_nfilters returned negative number of filters");
}
else
return( num_filters );
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getFilter
///\brief Returns information about a filter in a pipeline
///\param filter_number - IN: Filter to get, range [0..N-1], where
/// N is returned by H5Pget_nfilters()
///\param flags - OUT: General properties of the filter
///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
/// of values defined by the filter
///\param cd_values - OUT: Array to hold the data; allocated by the user
///\param namelen - OUT: 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.
//--------------------------------------------------------------------------
H5Z_filter_t DSetCreatPropList::getFilter(int filter_number,
unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
size_t namelen, char name[], unsigned int& filter_config) const
{
H5Z_filter_t filter_id;
filter_id = H5Pget_filter2(id, filter_number, &flags, &cd_nelmts,
cd_values, namelen, name, &filter_config);
if( filter_id == H5Z_FILTER_ERROR )
throw PropListIException("DSetCreatPropList::getFilter",
"H5Pget_filter2 returned H5Z_FILTER_ERROR");
else
return(filter_id);
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getFilterById
///\brief Returns information about a filter in a pipeline given the
/// filter id
///\param filter_id - IN: Filter to get
///\param flags - OUT: General properties of the filter
///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number
/// of values defined by the filter
///\param cd_values - OUT: Array to hold the data; allocated by the user
///\param namelen - IN: Length of \a name
///\param name - OUT: Name of the filter
///\param filter_config - OUT: Flags indicating whether filter can encode/decode
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id,
unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values,
size_t namelen, char name[], unsigned int &filter_config) const
{
herr_t ret_value = H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts,
cd_values, namelen, name, &filter_config);
if (ret_value < 0)
throw PropListIException("DSetCreatPropList::getFilterById",
"H5Pget_filter_by_id2 failed");
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::modifyFilter
///\brief Modifies the specified filter
///\param filter_id - IN: Filter to get
///\param flags - OUT: General properties of the filter
///\param cd_nelmts - IN: Number of elements in \a cd_values
/// \n OUT: Number of values defined by the filter
///\param cd_values - OUT: Array to hold the data; allocated by the user
///\exception H5::PropListIException
///\par Description
/// The \a flags argument is a bit vector of the field:
/// \c H5Z_FLAG_OPTIONAL(0x0001)
///\par
/// If this bit is set then the filter is optional. If the filter
/// fails during a DataSet::write() operation then the filter
/// is just excluded from the pipeline for the chunk for which it
/// failed; the filter will not participate in the pipeline
/// during a DataSet::read() of the chunk. If this bit is clear
/// and the filter fails then the entire I/O operation fails.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::modifyFilter( H5Z_filter_t filter_id, unsigned int
flags, size_t cd_nelmts, const unsigned int cd_values[] ) const
{
herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::modifyFilter",
"H5Pmodify_filter failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::allFiltersAvail
///\brief Queries whether all the filters set in this property list
/// are available currently.
///\return true if all filters available, and false if one or more
/// filters not currently available
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DSetCreatPropList::allFiltersAvail()
{
htri_t ret_value = H5Pall_filters_avail(id);
if( ret_value > 0 )
return true;
else if( ret_value == 0 )
return false;
else // Raise exception when H5Pall_filters_avail returns a negative value
{
throw PropListIException("DSetCreatPropList::allFiltersAvail", "H5Pall_filters_avail returned negative value");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setShuffle
///\brief Sets method of the shuffle filter
///
///\exception H5::PropListIException
///\par Description
/// Please refer to the Reference Manual of \c H5Pset_shuffle for
/// details.
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetShuffle
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setShuffle() const
{
herr_t ret_value = H5Pset_shuffle(id);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setShuffle",
"H5Pset_shuffle failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getAllocTime
///\brief Get space allocation time for this property.
///\return Space allocation time.
///\exception H5::PropListIException
///\par Description
/// The values of space allocation time can be one of the
/// followings:
/// \li \c H5D_ALLOC_TIME_DEFAULT
/// \li \c H5D_ALLOC_TIME_EARLY
/// \li \c H5D_ALLOC_TIME_LATE
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_alloc_time_t DSetCreatPropList::getAllocTime()
{
H5D_alloc_time_t alloc_time;
herr_t ret_value = H5Pget_alloc_time(id, &alloc_time);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::getAllocTime",
"H5Pget_alloc_time failed");
}
else
return (alloc_time);
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getFillTime
///\brief Gets fill value writing time.
///\return Fill value writing time
///\exception H5::PropListIException
///\par Description
/// Valid values for fill value writing time include
/// \li \c H5D_FILL_TIME_NEVER
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5D_fill_time_t DSetCreatPropList::getFillTime()
{
H5D_fill_time_t fill_time;
herr_t ret_value = H5Pget_fill_time(id, &fill_time);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::getFillTime",
"H5Pget_fill_time failed");
}
else
return (fill_time);
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setAllocTime
///\brief Sets space allocation time for dataset during creation.
///\param alloc_time - IN: Allocation time
///\exception H5::PropListIException
///\par Description
/// Valid values for space allocation time include:
/// \li \c H5D_ALLOC_TIME_DEFAULT
/// \li \c H5D_ALLOC_TIME_EARLY
/// \li \c H5D_ALLOC_TIME_LATE
/// \li \c H5D_ALLOC_TIME_INCR
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time)
{
herr_t ret_value = H5Pset_alloc_time(id, alloc_time);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setAllocTime",
"H5Pset_alloc_time failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setFillTime
///\brief Sets fill value writing time for dataset.
///\return Fill value writing time
///\exception H5::PropListIException
///\par Description
/// Valid values for fill value writing time include
/// \li \c H5D_FILL_TIME_NEVER
/// \li \c H5D_FILL_TIME_ALLOC.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time)
{
herr_t ret_value = H5Pset_fill_time(id, fill_time);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setFillTime",
"H5Pset_fill_time failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setFletcher32
///\brief Sets Fletcher32 checksum of EDC for this property list.
///
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setFletcher32() const
{
herr_t ret_value = H5Pset_fletcher32(id);
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setFletcher32",
"H5Pset_fletcher32 failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::setExternal
///\brief Adds an external file to the list of external files
///\param name - IN: Name of the external file
///\param offset - IN: Location where the data starts in the file
///\param size - IN: Number of bytes reserved in the file for the data
///\exception H5::PropListIException
///\par Description
/// If a dataset is splitted across multiple files then the files
/// should be defined in order. The total size of the dataset is
/// the sum of the \a size arguments for all the external files. If
/// the total size is larger than the size of a dataset then the
/// dataset can be extended (provided the data space also allows
/// the extending).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::setExternal( const char* name, off_t offset, hsize_t size ) const
{
herr_t ret_value = H5Pset_external( id, name, offset, size );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::setExternal",
"H5Pset_external failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getExternalCount
///\brief Returns the number of external files for a dataset
///\return Number of external files
///\exception H5::PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int DSetCreatPropList::getExternalCount() const
{
int num_ext_files = H5Pget_external_count( id );
if( num_ext_files < 0 )
{
throw PropListIException("DSetCreatPropList::getExternalCount",
"H5Pget_external_count returns negative number of external files");
}
else
return( num_ext_files );
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList::getExternal
///\brief Returns information about an external file
///\param idx - IN: Index of the external file, ranges [0-(N-1)] and
/// returned by getExternalCount()
///\param name_size - IN: Maximum length of \a name
///\param name - IN: Name of the external file
///\param offset - IN: Location to return an offset value
///\param size - OUT: Location to return the size of the external file data
///\exception H5::PropListIException
///\par Description
/// The parameter \a idx ranges [0..N-1] where N is returned by
/// getExternalCount(). At most \a name_size characters are copied
/// into the name array. If the external file name is longer than
/// name_size with the null terminator, the return value is not
/// null terminated (similar to strncpy()).
/// If \a name_size is zero or \a name is a null pointer, the
/// external file name will not be returned. If \a offset or
/// \a size are null pointers then the corresponding information
/// will not be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetCreatPropList::getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const
{
herr_t ret_value = H5Pget_external( id, idx, name_size, name, &offset, &size );
if( ret_value < 0 )
{
throw PropListIException("DSetCreatPropList::getExternal",
"H5Pget_external failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetCreatPropList destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetCreatPropList::~DSetCreatPropList () {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,126 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5DSCreatPropList_H
#define _H5DSCreatPropList_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP DSetCreatPropList : public PropList {
public:
// Default dataset creation property list.
static const DSetCreatPropList DEFAULT;
// Creates a dataset creation property list.
DSetCreatPropList();
// Queries whether all the filters set in this property list are
// available currently.
bool allFiltersAvail();
// Get space allocation time for this property.
H5D_alloc_time_t getAllocTime();
// Set space allocation time for dataset during creation.
void setAllocTime(H5D_alloc_time_t alloc_time);
// Retrieves the size of the chunks used to store a chunked layout dataset.
int getChunk( int max_ndims, hsize_t* dim ) const;
// Sets the size of the chunks used to store a chunked layout dataset.
void setChunk( int ndims, const hsize_t* dim ) const;
// Returns information about an external file.
void getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const;
// Returns the number of external files for a dataset.
int getExternalCount() const;
// Gets fill value writing time.
H5D_fill_time_t getFillTime();
// Sets fill value writing time for dataset.
void setFillTime(H5D_fill_time_t fill_time);
// Retrieves a dataset fill value.
void getFillValue( const DataType& fvalue_type, void* value ) const;
// Sets a dataset fill value.
void setFillValue( const DataType& fvalue_type, const void* value ) const;
// Returns information about a filter in a pipeline.
H5Z_filter_t getFilter(int filter_number, unsigned int& flags, size_t& cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
// Returns information about a filter in a pipeline given the filter id.
void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], unsigned int &filter_config) const;
// Gets the layout of the raw data storage of the data that uses this
// property list.
H5D_layout_t getLayout() const;
// Sets the type of storage used to store the raw data for the
// dataset that uses this property list.
void setLayout(H5D_layout_t layout) const;
// Returns the number of filters in the pipeline.
int getNfilters() const;
// Checks if fill value has been defined for this property.
H5D_fill_value_t isFillValueDefined();
// Modifies the specified filter.
void modifyFilter( H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[] ) const;
// Remove one or all filters from the filter pipeline.
void removeFilter( H5Z_filter_t filter_id) const;
// Sets compression method and compression level.
void setDeflate( int level ) const;
// Adds an external file to the list of external files.
void setExternal( const char* name, off_t offset, hsize_t size ) const;
// Adds a filter to the filter pipeline.
void setFilter( H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, const unsigned int cd_values[] = NULL) const;
// Sets Fletcher32 checksum of EDC for this property list.
void setFletcher32() const;
// Sets method of the shuffle filter.
void setShuffle() const;
// Sets SZIP compression method.
void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const;
///\brief Returns this class name
virtual H5std_string fromClass () const { return("DSetCreatPropList"); }
// Copy constructor: creates a copy of a DSetCreatPropList object.
DSetCreatPropList(const DSetCreatPropList& orig);
// Creates a copy of an existing dataset creation property list
// using the property list id.
DSetCreatPropList(const hid_t plist_id);
// Noop destructor.
virtual ~DSetCreatPropList();
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,441 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5DxferProp.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
//--------------------------------------------------------------------------
///\brief Constant for default dataset memory and transfer property list.
//--------------------------------------------------------------------------
const DSetMemXferPropList DSetMemXferPropList::DEFAULT;
//--------------------------------------------------------------------------
// Function DSetMemXferPropList default constructor
///\brief Default constructor: creates a stub dataset memory and
/// transfer property list object.
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) {}
//--------------------------------------------------------------------------
// Function DSetMemXferPropList copy constructor
///\brief Copy constructor: makes a copy of the original
/// DSetMemXferPropList object
///\param original - IN: Original dataset memory and transfer property
/// list object to copy
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList& original ) : PropList( original ) {}
//--------------------------------------------------------------------------
// Function DSetMemXferPropList overloaded constructor
///\brief Creates a DSetMemXferPropList object using the id of an
/// existing DSetMemXferPropList.
///\param plist_id - IN: Id of an existing dataset memory and transfer
/// property list
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) {}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setBuffer
///\brief Sets type conversion and background buffers.
///\param size - IN: Size, in bytes, of the type conversion and background buffers
///\param tconv - IN: Pointer to application-allocated type conversion buffer
///\param bkg - IN: Pointer to application-allocated background buffer
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::setBuffer( size_t size, void* tconv, void* bkg ) const
{
herr_t ret_value = H5Pset_buffer( id, size, tconv, bkg );
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::setBuffer",
"H5Pset_buffer failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getBuffer
///\brief Reads buffer settings.
///\param tconv - IN: Pointer to application-allocated type conversion buffer
///\param bkg - IN: Pointer to application-allocated background buffer
///\return Buffer size, in bytes
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
size_t DSetMemXferPropList::getBuffer( void** tconv, void** bkg ) const
{
size_t buffer_size = H5Pget_buffer( id, tconv, bkg );
if( buffer_size == 0 )
{
throw PropListIException("DSetMemXferPropList::getBuffer",
"H5Pget_buffer returned 0 for buffer size - failure");
}
return( buffer_size );
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setPreserve
///\brief Sets the dataset transfer property list status to true or false.
///\param status - IN: Status to set, true or false
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::setPreserve( bool status ) const
{
herr_t ret_value = H5Pset_preserve( id, (hbool_t) status );
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::setPreserve",
"H5Pset_preserve failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getPreserve
///\brief Checks status of the dataset transfer property list.
///\return Status of the dataset transfer property list
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
bool DSetMemXferPropList::getPreserve() const
{
int ret_value = H5Pget_preserve( id );
if( ret_value > 0 )
return true;
else if( ret_value == 0 )
return false;
else
{
throw PropListIException("DSetMemXferPropList::getPreserve",
"H5Pget_preserve returned negative value for status");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setBtreeRatios
///\brief Sets B-tree split ratios for a dataset transfer property list.
///\param left - IN: B-tree split ratio for left-most nodes
///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes
///\param right - IN: B-tree split ratio for all other nodes
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::setBtreeRatios( double left, double middle, double right ) const
{
herr_t ret_value = H5Pset_btree_ratios( id, left, middle, right );
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::setBtreeRatios",
"H5Pset_btree_ratios failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getBtreeRatios
///\brief Gets B-tree split ratios for a dataset transfer property list.
///\param left - OUT: B-tree split ratio for left-most nodes
///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes
///\param right - OUT: B-tree split ratio for all other nodes
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::getBtreeRatios( double& left, double& middle, double& right ) const
{
herr_t ret_value = H5Pget_btree_ratios( id, &left, &middle, &right );
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::getBtreeRatios",
"H5Pget_btree_ratios failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setTypeConvCB
///\brief Sets an exception handling callback for datatype conversion
/// for a dataset transfer property list.
///\param op - IN: User's function
///\param user_data - IN: User's data
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const
{
herr_t ret_value = H5Pset_type_conv_cb( id, op, user_data);
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::setTypeConvCB",
"H5Pset_type_conv_cb failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getTypeConvCB
///\brief Gets the exception handling callback function and data.
///\param op - IN: Retrieved user function
///\param user_data - IN: Retrieved user data
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const
{
herr_t ret_value = H5Pget_type_conv_cb( id, op, user_data);
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::getTypeConvCB",
"H5Pget_type_conv_cb failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setVlenMemManager
///\brief Sets the memory manager for variable-length datatype allocation.
///\param alloc_func - IN: User's allocate routine
///\param alloc_info - IN: User's allocation parameters
///\param free_func - IN: User's free routine
///\param free_info - IN: User's free parameters
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::setVlenMemManager( H5MM_allocate_t alloc_func, void* alloc_info, H5MM_free_t free_func, void* free_info ) const
{
herr_t ret_value = H5Pset_vlen_mem_manager( id, alloc_func, alloc_info,
free_func, free_info );
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::setVlenMemManager",
"H5Pset_vlen_mem_manager failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setVlenMemManager
///\brief Sets the memory manager for variable-length datatype
/// allocation - system \c malloc and \c free will be used.
///
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::setVlenMemManager() const
{
setVlenMemManager( NULL, NULL, NULL, NULL );
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getVlenMemManager
///\brief Gets the memory manager for variable-length datatype allocation
///\param alloc_func - OUT: User's allocate routine
///\param alloc_info - OUT: User's allocation parameters
///\param free_func - OUT: User's free routine
///\param free_info - OUT: User's free parameters
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void DSetMemXferPropList::getVlenMemManager( H5MM_allocate_t& alloc_func, void** alloc_info, H5MM_free_t& free_func, void** free_info ) const
{
herr_t ret_value = H5Pget_vlen_mem_manager( id, &alloc_func, alloc_info, &free_func, free_info );
if( ret_value < 0 )
{
throw PropListIException("DSetMemXferPropList::getVlenMemManager",
"H5Pget_vlen_mem_manager failed");
}
}
//--------------------------------------------------------------------------
// 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.
///\param size - IN: Maximum size, in bytes, of the small data block.
///\exception H5::PropListIException
///\par Description
/// For detail, please refer to the C layer Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetSmallData
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size)
{
herr_t ret_value = H5Pset_small_data_block_size(id, size);
if (ret_value < 0)
{
throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize",
"H5Pset_small_data_block_size failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getSmallDataBlockSize
///\brief Returns the current small data block size setting.
///\return Size of the small data block, in bytes
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
hsize_t DSetMemXferPropList::getSmallDataBlockSize()
{
hsize_t size;
herr_t ret_value = H5Pget_small_data_block_size(id, &size);
if (ret_value < 0)
{
throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize",
"H5Pget_small_data_block_size failed");
}
return(size);
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setHyperVectorSize
///\brief Sets number of I/O vectors to be read/written in hyperslab I/O.
///
///\exception H5::PropListIException
///\par Description
/// For information, please refer to the C layer Reference
/// Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetHyperVectorSize
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setHyperVectorSize(size_t vector_size)
{
herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size);
if (ret_value < 0)
{
throw PropListIException("DSetMemXferPropList::setHyperVectorSize",
"H5Pset_hyper_vector_size failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getHyperVectorSize
///\brief Returns the number of I/O vectors to be read/written in
/// hyperslab I/O.
///\return Number of I/O vectors
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
size_t DSetMemXferPropList::getHyperVectorSize()
{
size_t vector_size;
herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size);
if (ret_value < 0)
{
throw PropListIException("DSetMemXferPropList::getHyperVectorSize",
"H5Pget_hyper_vector_size failed");
}
return(vector_size);
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::setEDCCheck
///\brief Enables or disables error-detecting for a dataset reading
/// process.
///\param check - IN: Specifies whether error detection is enabled or
/// disabled
///\exception H5::PropListIException
///\par Description
/// The error detection algorithm used is the algorithm previously
/// specified in the corresponding dataset creation property
/// list. This function does not affect the use of error
/// detection in the writing process.
///\par
/// Valid values are as follows:
/// \li \c H5Z_ENABLE_EDC (default)
/// \li \c H5Z_DISABLE_EDC
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check)
{
herr_t ret_value = H5Pset_edc_check(id, check);
if (ret_value < 0)
{
throw PropListIException("DSetMemXferPropList::setEDCCheck",
"H5Pset_edc_check failed");
}
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList::getEDCCheck
///\brief Determines whether error-detection is enabled for dataset reads.
///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC
///\exception H5::PropListIException
// Programmer: Binh-Minh Ribler - April, 2004
//--------------------------------------------------------------------------
H5Z_EDC_t DSetMemXferPropList::getEDCCheck()
{
H5Z_EDC_t check = H5Pget_edc_check(id);
if (check < 0)
{
throw PropListIException("DSetMemXferPropList::getEDCCheck",
"H5Pget_edc_check failed");
}
return(check);
}
//--------------------------------------------------------------------------
// Function: DSetMemXferPropList destructor
///\brief Noop destructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
DSetMemXferPropList::~DSetMemXferPropList() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,111 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5DSetMemXferPropList_H
#define _H5DSetMemXferPropList_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP DSetMemXferPropList : public PropList {
public:
static const DSetMemXferPropList DEFAULT;
// Creates a dataset memory and transfer property list.
DSetMemXferPropList();
// Sets type conversion and background buffers.
void setBuffer( size_t size, void* tconv, void* bkg ) const;
// Reads buffer settings.
size_t getBuffer( void** tconv, void** bkg ) const;
// Sets B-tree split ratios for a dataset transfer property list.
void setBtreeRatios( double left, double middle, double right ) const;
// Gets B-tree split ratios for a dataset transfer property list.
void getBtreeRatios( double& left, double& middle, double& right ) const;
// Sets the dataset transfer property list status to TRUE or FALSE.
void setPreserve( bool status ) const;
// Checks status of the dataset transfer property list.
bool getPreserve() const;
// Sets an exception handling callback for datatype conversion.
void setTypeConvCB( H5T_conv_except_func_t op, void *user_data) const;
// Gets the exception handling callback for datatype conversion.
void getTypeConvCB( H5T_conv_except_func_t *op, void **user_data) const;
// Sets the memory manager for variable-length datatype
// allocation in H5Dread and H5Dvlen_reclaim.
void setVlenMemManager( H5MM_allocate_t alloc, void* alloc_info,
H5MM_free_t free, void* free_info ) const;
// alloc and free are set to NULL, indicating that system
// malloc and free are to be used.
void setVlenMemManager() const;
// Gets the memory manager for variable-length datatype
// allocation in H5Dread and H5Tvlen_reclaim.
void getVlenMemManager( H5MM_allocate_t& alloc, void** alloc_info,
H5MM_free_t& free, void** free_info ) const;
// Sets the 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);
// Returns the current small data block size setting.
hsize_t getSmallDataBlockSize();
// Sets number of I/O vectors to be read/written in hyperslab I/O.
void setHyperVectorSize(size_t vector_size);
// Returns the number of I/O vectors to be read/written in
// hyperslab I/O.
size_t getHyperVectorSize();
// Enables or disables error-detecting for a dataset reading
// process.
void setEDCCheck(H5Z_EDC_t check);
// Determines whether error-detection is enabled for dataset reads.
H5Z_EDC_t getEDCCheck();
///\brief Returns this class name.
virtual H5std_string fromClass () const { return("DSetMemXferPropList"); }
// Copy constructor: makes a copy of a DSetMemXferPropList object.
DSetMemXferPropList(const DSetMemXferPropList& orig);
// Creates a copy of an existing dataset memory and transfer
// property list using the property list id.
DSetMemXferPropList(const hid_t plist_id);
// Noop destructor
virtual ~DSetMemXferPropList();
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,278 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#include "H5IdComponent.h"
#include "H5PropList.h"
#include "H5Object.h"
#include "H5AbstractDs.h"
#include "H5DxferProp.h"
#include "H5DataSpace.h"
#include "H5DcreatProp.h"
#include "H5CommonFG.h"
#include "H5DataType.h"
#include "H5DataSet.h"
#include "H5AtomType.h"
#include "H5IntType.h"
#include "H5EnumType.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
//--------------------------------------------------------------------------
// Function: EnumType default constructor
///\brief Default constructor: Creates a stub datatype
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType() : DataType() {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
///\brief Creates an EnumType object using the id of an existing datatype.
///\param existing_id - IN: Id of an existing datatype
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType( const hid_t existing_id ) : DataType( existing_id ) {}
//--------------------------------------------------------------------------
// Function: EnumType copy constructor
///\brief Copy constructor: makes a copy of the original EnumType object.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType( const EnumType& original ) : DataType( original ) {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
///\brief Creates an empty enumeration datatype given a size, in bytes.
///\param size - IN: Number of bytes in the datatype to create
///\exception H5::DataTypeIException
// Description
// The DataType constructor calls the C API H5Tcreate to create
// the enum datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType( size_t size ) : DataType( H5T_ENUM, size ) {}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
///\brief Gets the enum datatype of the specified dataset.
///\param dataset - IN: Dataset that this enum datatype associates with
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType( const DataSet& dataset ) : DataType()
{
// Calls C function H5Dget_type to get the id of the datatype
id = H5Dget_type( dataset.getId() );
// If the datatype id is not valid, throw an exception
if( id < 0 )
{
throw DataSetIException("EnumType constructor", "H5Dget_type failed");
}
}
//--------------------------------------------------------------------------
// Function: EnumType overloaded constructor
///\brief Creates a new enum datatype based on an integer datatype.
///\param data_type - IN: Base datatype
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::EnumType( const IntType& data_type ) : DataType()
{
// Calls C function H5Tenum_create to get the id of the datatype
id = H5Tenum_create( data_type.getId() );
// If the datatype id is not valid, throw an exception
if( id < 0 )
{
throw DataSetIException("EnumType constructor", "H5Tenum_create failed");
}
}
//--------------------------------------------------------------------------
// Function: EnumType::insert
///\brief Inserts a new member to this enumeration datatype.
///\param name - IN: Name of the new member
///\param value - IN: Pointer to the value of the new member
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::insert( const char* name, void *value ) const
{
// Calls C routine H5Tenum_insert to insert the new enum datatype member.
herr_t ret_value = H5Tenum_insert( id, name, value );
if( ret_value < 0 )
{
throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed");
}
}
//--------------------------------------------------------------------------
// Function: EnumType::insert
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in the type of
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::insert( const H5std_string& name, void *value ) const
{
insert( name.c_str(), value );
}
//--------------------------------------------------------------------------
// Function: EnumType::nameOf
///\brief Returns the symbol name corresponding to a specified member
/// of this enumeration datatype.
///\param value - IN: Pointer to the value of the enum datatype
///\param size - IN: Size for the name
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string EnumType::nameOf( void *value, size_t size ) const
{
char* name_C = new char[size+1]; // temporary C-string for C API
// Calls C routine H5Tenum_nameof to get the name of the specified enum type
herr_t ret_value = H5Tenum_nameof( id, value, name_C, size );
// If H5Tenum_nameof returns a negative value, raise an exception,
if( ret_value < 0 )
{
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);
delete []name_C;
return( name );
}
//--------------------------------------------------------------------------
// Function: EnumType::valueOf
///\brief Retrieves the value corresponding to a member of this
/// enumeration datatype, given the member's name.
///\param name - IN: Name of the queried member
///\param value - OUT: Pointer to the retrieved value
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::valueOf( const char* name, void *value ) const
{
// Calls C routine H5Tenum_valueof to get the enum datatype value
herr_t ret_value = H5Tenum_valueof( id, name, value );
if( ret_value < 0 )
{
throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed");
}
}
//--------------------------------------------------------------------------
// Function: EnumType::valueOf
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in the type of
/// argument \a name.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::valueOf( const H5std_string& name, void *value ) const
{
valueOf( name.c_str(), value );
}
//--------------------------------------------------------------------------
// Function: EnumType::getMemberIndex
///\brief Returns the index of a member in this enumeration datatype.
///\param name - IN: Name of the queried member
///\return Index of the member if it exists. Index will have the value
/// between 0 and \c N-1, where \c N is the value returned by the
/// member function \c EnumType::getNmembers.
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
int EnumType::getMemberIndex(const char *name) const
{
int member_index = H5Tget_member_index(id, name);
if( member_index < 0 )
{
throw DataTypeIException("EnumType::getMemberIndex",
"H5Tget_member_index returns negative value");
}
return( member_index );
}
//--------------------------------------------------------------------------
// Function: EnumType::getMemberIndex
///\brief This is an overloaded member function, provided for convenience.
/// It differs from the above function only in the type of
/// argument \a name.
// Programmer Binh-Minh Ribler - May 16, 2002
//--------------------------------------------------------------------------
int EnumType::getMemberIndex(const H5std_string& name) const
{
return(EnumType::getMemberIndex(name.c_str()));
}
//--------------------------------------------------------------------------
// Function: EnumType::getNmembers
///\brief Returns the number of members in this enumeration datatype.
///\return Number of members
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - May, 2004
//--------------------------------------------------------------------------
int EnumType::getNmembers() const
{
int num_members = H5Tget_nmembers( id );
if( num_members < 0 )
{
throw DataTypeIException("EnumType::getNmembers",
"H5Tget_nmembers returns negative number of members");
}
return( num_members );
}
//--------------------------------------------------------------------------
// Function: EnumType::getMemberValue
///\brief Retrieves the value of a member in this enumeration datatype,
/// given the member's index.
///\param memb_no - IN: Index of the queried member
///\param value - OUT: Pointer to the retrieved value
///\exception H5::DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void EnumType::getMemberValue( unsigned memb_no, void *value ) const
{
// Call C routine H5Tget_member_value to get the datatype member's value
hid_t ret_value = H5Tget_member_value( id, memb_no, value );
if( ret_value < 0 )
{
throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed");
}
}
//--------------------------------------------------------------------------
// Function: EnumType destructor
///\brief Properly terminates access to this enum datatype.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
EnumType::~EnumType() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,77 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5EnumType_H
#define _H5EnumType_H
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
class H5_DLLCPP EnumType : public DataType {
public:
// Creates an empty enumeration datatype based on a native signed
// integer type, whose size is given by size.
EnumType( size_t size );
// Gets the enum datatype of the specified dataset
EnumType( const DataSet& dataset ); // H5Dget_type
// Creates a new enum datatype based on an integer datatype
EnumType( const IntType& data_type ); // H5Tenum_create
// Returns the number of members in this enumeration datatype.
int getNmembers () const;
// Returns the index of a member in this enumeration data type.
int getMemberIndex(const char* name) const;
int getMemberIndex(const H5std_string& name) const;
// Returns the value of an enumeration datatype member
void getMemberValue( unsigned memb_no, void *value ) const;
// Inserts a new member to this enumeration type.
void insert( const char* name, void *value ) const;
void insert( const H5std_string& name, void *value ) const;
// Returns the symbol name corresponding to a specified member
// of this enumeration datatype.
H5std_string nameOf( void *value, size_t size ) const;
// Returns the value corresponding to a specified member of this
// enumeration datatype.
void valueOf( const char* name, void *value ) const;
void valueOf( const H5std_string& name, void *value ) const;
///\brief Returns this class name
virtual H5std_string fromClass () const { return("EnumType"); }
// Default constructor
EnumType();
// Creates an enumeration datatype using an existing id
EnumType( const hid_t existing_id );
// Copy constructor: makes a copy of the original EnumType object.
EnumType( const EnumType& original );
virtual ~EnumType();
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif

View File

@@ -0,0 +1,548 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <string>
#include "H5Include.h"
#include "H5Exception.h"
#ifndef H5_NO_NAMESPACE
namespace H5 {
#endif
const char Exception::DEFAULT_MSG[] = "No detailed information provided";
//--------------------------------------------------------------------------
// Function: Exception default constructor
///\brief Default constructor.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Exception::Exception() : detail_message(""), func_name("") {}
//--------------------------------------------------------------------------
// Function: Exception overloaded constructor
///\brief Creates an exception with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: Exception copy constructor
///\brief Copy constructor: makes a copy of the original Exception object.
///\param orig - IN: Exception instance to copy
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Exception::Exception( const Exception& orig )
{
detail_message = orig.detail_message;
func_name = orig.func_name;
}
//--------------------------------------------------------------------------
// Function: Exception::getMajorString
///\brief Returns a text string that describes the error
/// specified by a major error number.
///\param err_major - IN: Major error number
///\return Major error string
///\par Description
/// In the failure case, the string "Invalid major error number"
/// will be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string Exception::getMajorString( hid_t err_major ) const
{
// Preliminary call to H5Eget_msg() to get the length of the message
ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0);
// If H5Eget_msg() returns a negative value, raise an exception,
if( mesg_size < 0 )
throw IdComponentException("Exception::getMajorString",
"H5Eget_msg failed");
// Call H5Eget_msg again to get the actual message
char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
mesg_size = H5Eget_msg(err_major, NULL, mesg_C, mesg_size+1);
// Check for failure again
if( mesg_size < 0 )
throw IdComponentException("Exception::getMajorString",
"H5Eget_msg failed");
// Convert the C error description and return
H5std_string major_str(mesg_C);
delete []mesg_C;
return( major_str );
}
//--------------------------------------------------------------------------
// Function: Exception::getMinorString
///\brief Returns a text string that describes the error
/// specified by a minor error number.
///\param err_minor - IN: Minor error number
///\return Minor error string
///\par Description
/// In the failure case, the string "Invalid minor error number"
/// will be returned.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string Exception::getMinorString( hid_t err_minor ) const
{
// Preliminary call to H5Eget_msg() to get the length of the message
ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0);
// If H5Eget_msg() returns a negative value, raise an exception,
if( mesg_size < 0 )
throw IdComponentException("Exception::getMinorString",
"H5Eget_msg failed");
// Call H5Eget_msg again to get the actual message
char* mesg_C = new char[mesg_size+1]; // temporary C-string for C API
mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, mesg_size+1);
// Check for failure again
if( mesg_size < 0 )
throw IdComponentException("Exception::getMinorString",
"H5Eget_msg failed");
// Convert the C error description and return
H5std_string minor_str(mesg_C);
delete []mesg_C;
return( minor_str );
}
//--------------------------------------------------------------------------
// Function: Exception::setAutoPrint
///\brief Turns on the automatic error printing.
///\param func - IN: Function to be called upon an error condition
///\param client_data - IN: Data passed to the error function
///\par Description
/// When the library is first initialized the auto printing
/// function, \a func, is set to the C API \c H5Eprint and
/// \a client_data is the standard error stream pointer, \c stderr.
/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD
/// direction.
///\par
/// Users are encouraged to write their own more specific error
/// handlers
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::setAutoPrint( H5E_auto2_t& func, void* client_data )
{
// calls the C API routine H5Eset_auto to set the auto printing to
// the specified function.
herr_t ret_value = H5Eset_auto2( H5E_DEFAULT, func, client_data );
if( ret_value < 0 )
throw Exception( "Exception::setAutoPrint", "H5Eset_auto failed" );
}
//--------------------------------------------------------------------------
// Function: Exception::dontPrint
///\brief Turns off the automatic error printing from the C library.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::dontPrint()
{
// calls the C API routine H5Eset_auto with NULL parameters to turn
// off the automatic error printing.
herr_t ret_value = H5Eset_auto2( H5E_DEFAULT, NULL, NULL );
if( ret_value < 0 )
throw Exception( "Exception::dontPrint", "H5Eset_auto failed" );
}
//--------------------------------------------------------------------------
// Function: Exception::getAutoPrint
///\brief Retrieves the current settings for the automatic error
/// stack traversal function and its data.
///\param func - OUT: Current setting for the function to be
/// called upon an error condition
///\param client_data - OUT: Current setting for the data passed to
/// the error function
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::getAutoPrint( H5E_auto2_t& func, void** client_data )
{
// calls the C API routine H5Eget_auto to get the current setting of
// the automatic error printing
herr_t ret_value = H5Eget_auto2( H5E_DEFAULT, &func, client_data );
if( ret_value < 0 )
throw Exception( "Exception::getAutoPrint", "H5Eget_auto failed" );
}
//--------------------------------------------------------------------------
// Function: Exception::clearErrorStack
///\brief Clears the error stack for the current thread.
///\par Description
/// The stack is also cleared whenever a C API function is
/// called, with certain exceptions (for instance, \c H5Eprint).
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::clearErrorStack()
{
// calls the C API routine H5Eclear to clear the error stack
herr_t ret_value = H5Eclear2(H5E_DEFAULT);
if( ret_value < 0 )
throw Exception( "Exception::clearErrorStack", "H5Eclear failed" );
}
//--------------------------------------------------------------------------
// Function: Exception::walkErrorStack
///\brief Walks the error stack for the current thread, calling the
/// specified function.
///\param direction - IN: Direction in which the error stack is to be walked
///\param func - IN: Function to be called for each error encountered
///\param client_data - IN: Data passed to the error function
///\par Description
/// Valid values for \a direction include:
/// \li \c H5E_WALK_UPWARD - begin with the most specific error
/// and end at the API
/// \li \c H5E_WALK_DOWNWARD - begin at the API and end at the
/// inner-most function where the error was first detected
///\par
/// The function specified by \a func will be called for each
/// error in the error stack. The \c H5E_walk_t prototype is as
/// follows:
///\code
/// typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data)
/// int n - Indexed position of the error in the stack; it begins at zero
/// regardless of stack traversal direction
/// H5E_error_t *err_desc - Pointer to a data structure describing the
/// error. This structure is listed below.
/// void *client_data - Pointer to client data in the format expected by
/// the user-defined function.
///\endcode
///\par
/// Data structure to describe the error:
///\code
/// typedef struct H5E_error2_t {
/// hid_t cls_id; //class ID
/// hid_t maj_num; //major error ID
/// hid_t min_num; //minor error number
/// const char *func_name; //function in which error occurred
/// const char *file_name; //file in which error occurred
/// unsigned line; //line in file where error occurs
/// const char *desc; //optional supplied description
/// } H5E_error2_t;
///\endcode
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::walkErrorStack( H5E_direction_t direction, H5E_walk2_t func, void* client_data )
{
// calls the C API routine H5Ewalk to walk the error stack
herr_t ret_value = H5Ewalk2( H5E_DEFAULT, direction, func, client_data );
if( ret_value < 0 )
throw Exception( "Exception::walkErrorStack", "H5Ewalk failed" );
}
//--------------------------------------------------------------------------
// Function: Exception::getDetailMsg
///\brief Returns the detailed message set at the time the exception
/// is thrown.
///\return Text message - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string Exception::getDetailMsg() const
{
return(detail_message);
}
//--------------------------------------------------------------------------
// Function: Exception::getCDetailMsg
///\brief Returns the detailed message set at the time the exception
/// is thrown.
///\return Text message - \c char pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
const char* Exception::getCDetailMsg() const
{
return(detail_message.c_str());
}
//--------------------------------------------------------------------------
// Function: Exception::getFuncName
///\brief Returns the name of the function, where the exception is thrown.
///\return Text message - \c H5std_string
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5std_string Exception::getFuncName() const
{
return(func_name);
}
//--------------------------------------------------------------------------
// Function: Exception::getCFuncName
///\brief Returns the name of the function, where the exception is thrown.
///\return Text message - \c char pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
const char* Exception::getCFuncName() const
{
return(func_name.c_str());
}
//--------------------------------------------------------------------------
// Function: Exception::printError
///\brief Prints the error stack in a default manner.
///\param stream - IN: File pointer
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
void Exception::printError( FILE* stream ) const
{
herr_t ret_value = H5Eprint2( H5E_DEFAULT, stream ); // print to stderr
if( ret_value < 0 )
throw Exception( "Exception::printError", "H5Eprint failed" );
}
//--------------------------------------------------------------------------
// Function: Exception destructor
///\brief Noop destructor
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
Exception::~Exception() {}
//--------------------------------------------------------------------------
// Subclass: FileIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: FileIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
FileIException::FileIException():Exception(){}
//--------------------------------------------------------------------------
// Function: FileIException overloaded constructor
///\brief Creates a FileIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: FileIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
FileIException::~FileIException() {}
//--------------------------------------------------------------------------
// Subclass: GroupIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: GroupIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
GroupIException::GroupIException():Exception(){}
//--------------------------------------------------------------------------
// Function: GroupIException overloaded constructor
///\brief Creates a GroupIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: GroupIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
GroupIException::~GroupIException() {}
//--------------------------------------------------------------------------
// Subclass: DataSpaceIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: DataSpaceIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
DataSpaceIException::DataSpaceIException():Exception(){}
//--------------------------------------------------------------------------
// Function: DataSpaceIException overloaded constructor
///\brief Creates a DataSpaceIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: DataSpaceIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
DataSpaceIException::~DataSpaceIException() {}
//--------------------------------------------------------------------------
// Subclass: DataTypeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: DataTypeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
DataTypeIException::DataTypeIException():Exception(){}
//--------------------------------------------------------------------------
// Function: DataTypeIException overloaded constructor
///\brief Creates a DataTypeIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: DataTypeIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
DataTypeIException::~DataTypeIException() {}
//--------------------------------------------------------------------------
// Subclass: PropListIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: PropListIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
PropListIException::PropListIException():Exception(){}
//--------------------------------------------------------------------------
// Function: PropListIException overloaded constructor
///\brief Creates a PropListIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: PropListIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
PropListIException::~PropListIException() {}
//--------------------------------------------------------------------------
// Subclass: DataSetIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: DataSetIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
DataSetIException::DataSetIException():Exception(){}
//--------------------------------------------------------------------------
// Function: DataSetIException overloaded constructor
///\brief Creates a DataSetIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: DataSetIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
DataSetIException::~DataSetIException() {}
//--------------------------------------------------------------------------
// Subclass: AttributeIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: AttributeIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
AttributeIException::AttributeIException():Exception(){}
//--------------------------------------------------------------------------
// Function: AttributeIException overloaded constructor
///\brief Creates an AttributeIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: AttributeIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
AttributeIException::~AttributeIException() {}
//--------------------------------------------------------------------------
// Subclass: ReferenceException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: ReferenceException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
ReferenceException::ReferenceException():Exception(){}
//--------------------------------------------------------------------------
// Function: ReferenceException overloaded constructor
///\brief Creates a ReferenceException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: ReferenceException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
ReferenceException::~ReferenceException() {}
//--------------------------------------------------------------------------
// Subclass: LibraryIException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: LibraryIException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
LibraryIException::LibraryIException():Exception(){}
//--------------------------------------------------------------------------
// Function: LibraryIException overloaded constructor
///\brief Creates a LibraryIException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: LibraryIException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
LibraryIException::~LibraryIException() {}
//--------------------------------------------------------------------------
// Subclass: IdComponentException
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Function: IdComponentException default constructor
///\brief Default constructor.
//--------------------------------------------------------------------------
IdComponentException::IdComponentException(): Exception() {}
//--------------------------------------------------------------------------
// Function: IdComponentException overloaded constructor
///\brief Creates a IdComponentException with the name of the function,
/// in which the failure occurs, and an optional detailed message.
///\param func_name - 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) {}
//--------------------------------------------------------------------------
// Function: IdComponentException destructor
///\brief Noop destructor.
//--------------------------------------------------------------------------
IdComponentException::~IdComponentException() {}
#ifndef H5_NO_NAMESPACE
} // end namespace
#endif

View File

@@ -0,0 +1,164 @@
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef _H5Exception_H
#define _H5Exception_H
#include <string>
#ifndef H5_NO_NAMESPACE
namespace H5 {
#ifdef H5_NO_STD
#define H5std_string ::string
#else
#define H5std_string std::string
#endif
#endif
class H5_DLLCPP Exception {
public:
// Creates an exception with a function name where the failure occurs
// and an optional detailed message
Exception(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
// Returns a character string that describes the error specified by
// a major error number.
H5std_string getMajorString( hid_t err_major_id ) const;
// Returns a character string that describes the error specified by
// a minor error number.
H5std_string getMinorString( hid_t err_minor_id ) const;
// Returns the detailed message set at the time the exception is thrown
H5std_string getDetailMsg() const;
const char* getCDetailMsg() const; // C string of detailed message
H5std_string getFuncName() const; // function name as a string object
const char* getCFuncName() const; // function name as a char string
// Turns on the automatic error printing.
static void setAutoPrint( H5E_auto2_t& func, void* client_data);
// Turns off the automatic error printing.
static void dontPrint();
// Retrieves the current settings for the automatic error stack
// traversal function and its data.
static void getAutoPrint( H5E_auto2_t& func, void** client_data);
// Clears the error stack for the current thread.
static void clearErrorStack();
// Walks the error stack for the current thread, calling the
// specified function.
static void walkErrorStack( H5E_direction_t direction,
H5E_walk2_t func, void* client_data);
// Prints the error stack in a default manner.
virtual void printError( FILE* stream = NULL ) const;
// Default constructor
Exception();
// copy constructor
Exception( const Exception& orig);
// virtual Destructor
virtual ~Exception();
private:
H5std_string detail_message;
H5std_string func_name;
protected:
// Default value for detail_message
static const char DEFAULT_MSG[];
};
class H5_DLLCPP FileIException : public Exception {
public:
FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
FileIException();
virtual ~FileIException();
};
class H5_DLLCPP GroupIException : public Exception {
public:
GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
GroupIException();
virtual ~GroupIException();
};
class H5_DLLCPP DataSpaceIException : public Exception {
public:
DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
DataSpaceIException();
virtual ~DataSpaceIException();
};
class H5_DLLCPP DataTypeIException : public Exception {
public:
DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
DataTypeIException();
virtual ~DataTypeIException();
};
class H5_DLLCPP PropListIException : public Exception {
public:
PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
PropListIException();
virtual ~PropListIException();
};
class H5_DLLCPP DataSetIException : public Exception {
public:
DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
DataSetIException();
virtual ~DataSetIException();
};
class H5_DLLCPP AttributeIException : public Exception {
public:
AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
AttributeIException();
virtual ~AttributeIException();
};
class H5_DLLCPP ReferenceException : public Exception {
public:
ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
ReferenceException();
virtual ~ReferenceException();
};
class H5_DLLCPP LibraryIException : public Exception {
public:
LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
LibraryIException();
virtual ~LibraryIException();
};
class H5_DLLCPP IdComponentException : public Exception {
public:
IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG);
IdComponentException();
virtual ~IdComponentException();
};
#ifndef H5_NO_NAMESPACE
}
#endif
#endif // _H5Exception_H

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