summaryrefslogtreecommitdiffstats
path: root/hl/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2013-01-21 22:47:00 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2013-01-21 22:47:00 (GMT)
commitbadedee44d8475964c5235a3435c50f45e148d5e (patch)
tree27743f130e9f212092c49a6bc0da9899859a239f /hl/src
parent17f2fde031155047beaf003c00427e4f9787abc9 (diff)
downloadhdf5-badedee44d8475964c5235a3435c50f45e148d5e.zip
hdf5-badedee44d8475964c5235a3435c50f45e148d5e.tar.gz
hdf5-badedee44d8475964c5235a3435c50f45e148d5e.tar.bz2
[svn-r23182] I'm merging the changes for DECTRIS project from the trunk (r23162).
Tested on koala, jam, ostrich.
Diffstat (limited to 'hl/src')
-rw-r--r--hl/src/CMakeLists.txt2
-rw-r--r--hl/src/H5DO.c137
-rw-r--r--hl/src/H5DOprivate.h37
-rw-r--r--hl/src/H5DOpublic.h42
-rw-r--r--hl/src/Makefile.am4
-rw-r--r--hl/src/Makefile.in9
-rw-r--r--hl/src/hdf5_hl.h1
7 files changed, 226 insertions, 6 deletions
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 2df2c23..36547f0 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -14,6 +14,7 @@ ENDIF (BUILD_SHARED_LIBS)
INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
SET (HL_SRCS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5DO.c
${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c
${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c
${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c
@@ -24,6 +25,7 @@ SET (HL_SRCS
)
SET (HL_HEADERS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c
new file mode 100644
index 0000000..9cfd8c1
--- /dev/null
+++ b/hl/src/H5DO.c
@@ -0,0 +1,137 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* 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.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+
+#include "H5DOprivate.h"
+
+/*-------------------------------------------------------------------------
+ * Function: H5DOwrite_chunk
+ *
+ * Purpose: Writes an entire chunk to the file directly.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * 30 July 2012
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf)
+{
+ hbool_t created_dxpl = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ if(dset_id < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(!buf) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(!offset) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(!data_size) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5P_DEFAULT == dxpl_id) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ created_dxpl = TRUE;
+ }
+
+ if(H5DO_write_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+done:
+ if(created_dxpl) {
+ if(H5Pclose(dxpl_id) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5DO_write_chunk
+ *
+ * Purpose: Private function for H5DOwrite_chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * 30 July 2012
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5DO_write_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf)
+{
+ hbool_t do_direct_write = TRUE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+done:
+ do_direct_write = FALSE;
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0)
+ ret_value = FAIL;
+
+ return ret_value;
+}
diff --git a/hl/src/H5DOprivate.h b/hl/src/H5DOprivate.h
new file mode 100644
index 0000000..fcea585
--- /dev/null
+++ b/hl/src/H5DOprivate.h
@@ -0,0 +1,37 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 _H5DOprivate_H
+#define _H5DOprivate_H
+
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
+/* public LT prototypes */
+#include "H5DOpublic.h"
+
+/*-------------------------------------------------------------------------
+ * Private functions
+ *-------------------------------------------------------------------------
+ */
+
+H5_HLDLL herr_t H5DO_write_chunk(hid_t dset_id,
+ hid_t dxpl_id,
+ uint32_t filters,
+ const hsize_t *offset,
+ size_t data_size,
+ const void *buf);
+
+#endif
diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h
new file mode 100644
index 0000000..774709e
--- /dev/null
+++ b/hl/src/H5DOpublic.h
@@ -0,0 +1,42 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 _H5DOpublic_H
+#define _H5DOpublic_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-------------------------------------------------------------------------
+ *
+ * Direct chunk write function
+ *
+ *-------------------------------------------------------------------------
+ */
+
+H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id,
+ hid_t dxpl_id,
+ uint32_t filters,
+ const hsize_t *offset,
+ size_t data_size,
+ const void *buf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am
index f3d09ab..1e781a9 100644
--- a/hl/src/Makefile.am
+++ b/hl/src/Makefile.am
@@ -31,12 +31,12 @@ lib_LTLIBRARIES=libhdf5_hl.la
libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# List sources to include in the HDF5 HL Library.
-libhdf5_hl_la_SOURCES=H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c
+libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c
# HDF5 HL library depends on HDF5 Library.
libhdf5_hl_la_LIBADD=$(LIBHDF5)
# Public header files (to be installed)
-include_HEADERS=hdf5_hl.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h
+include_HEADERS=hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h
include $(top_srcdir)/config/conclude.am
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 3818c9b..21d7e00 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -114,8 +114,8 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_hl_la_DEPENDENCIES = $(LIBHDF5)
-am_libhdf5_hl_la_OBJECTS = H5DS.lo H5IM.lo H5LT.lo H5LTanalyze.lo \
- H5LTparse.lo H5PT.lo H5TB.lo
+am_libhdf5_hl_la_OBJECTS = H5DO.lo H5DS.lo H5IM.lo H5LT.lo \
+ H5LTanalyze.lo H5LTparse.lo H5PT.lo H5TB.lo
libhdf5_hl_la_OBJECTS = $(am_libhdf5_hl_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -467,13 +467,13 @@ lib_LTLIBRARIES = libhdf5_hl.la
libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# List sources to include in the HDF5 HL Library.
-libhdf5_hl_la_SOURCES = H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c
+libhdf5_hl_la_SOURCES = H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c
# HDF5 HL library depends on HDF5 Library.
libhdf5_hl_la_LIBADD = $(LIBHDF5)
# Public header files (to be installed)
-include_HEADERS = hdf5_hl.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h
+include_HEADERS = hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h
# 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.,
@@ -572,6 +572,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DO.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DS.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IM.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LT.Plo@am__quote@
diff --git a/hl/src/hdf5_hl.h b/hl/src/hdf5_hl.h
index 0fff932..4643932 100644
--- a/hl/src/hdf5_hl.h
+++ b/hl/src/hdf5_hl.h
@@ -22,6 +22,7 @@
#ifndef _HDF5_HL_H
#define _HDF5_HL_H
+#include "H5DOpublic.h" /* dataset optimization */
#include "H5DSpublic.h" /* dimension scales */
#include "H5LTpublic.h" /* lite */
#include "H5IMpublic.h" /* image */