From 4d348dbe0da3709708a72b5266e3291d00a5bbd9 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 11 Mar 2011 16:11:23 +0000 Subject: [PATCH] - function hdf5_get_dataset_info_by_name() added - args of function hdf5_get_npoints_of_dataset_by_name() are now const --- src/h5core/h5_hdf5.c | 30 ++++++++++++++++++++++++++++-- src/h5core/h5_hdf5_private.h | 13 +++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/h5core/h5_hdf5.c b/src/h5core/h5_hdf5.c index 1ae2e1e..b2a136b 100644 --- a/src/h5core/h5_hdf5.c +++ b/src/h5core/h5_hdf5.c @@ -435,8 +435,8 @@ hdf5_get_npoints_of_dataset ( h5_ssize_t hdf5_get_npoints_of_dataset_by_name ( - hid_t loc_id, - char* name + const hid_t loc_id, + const char* const name ) { HDF5_WRAPPER_ENTER3 (h5_ssize_t, "loc_id=%d (%s), name=\"%s\"", @@ -1628,6 +1628,32 @@ hdf5_get_dataset_info_by_idx ( H5_CORE_API_RETURN (H5_SUCCESS); } +h5_err_t +hdf5_get_dataset_info_by_name ( + const hid_t loc_id, /*!< [in] Group */ + const hsize_t idx, /*!< [in] Index of the dataset */ + const char* name, /*!< [in] Name of dataset */ + h5_int64_t* const type, /*!< [out] Type of data in dataset */ + hsize_t* const npoints /*!< [out] Number of elements. */ + ) { + HDF5_WRAPPER_ENTER4 (h5_err_t, + "loc_id=%d (%s), idx=%llu, name=\"%s\"", + loc_id, hdf5_get_objname (loc_id), + idx, name); + if (npoints) { + h5_ssize_t np; + TRY (np = hdf5_get_npoints_of_dataset_by_name (loc_id, name)); + *npoints = np; + } + + if (type) { + h5_int64_t t; + TRY (t = h5_get_dataset_type (loc_id, name)); + *type = t; + } + H5_CORE_API_RETURN (H5_SUCCESS); +} + /****** I d e n t i f i e r **************************************************/ const char * diff --git a/src/h5core/h5_hdf5_private.h b/src/h5core/h5_hdf5_private.h index c6dc721..cb66e2f 100644 --- a/src/h5core/h5_hdf5_private.h +++ b/src/h5core/h5_hdf5_private.h @@ -97,8 +97,8 @@ hdf5_get_npoints_of_dataset ( h5_ssize_t hdf5_get_npoints_of_dataset_by_name ( - hid_t loc_id, - char* name + const hid_t loc_id, + const char* const name ); /*** dataspace ***/ @@ -377,4 +377,13 @@ hdf5_delete_link ( hid_t lapl_id ); +/*** other ***/ +h5_err_t +hdf5_get_dataset_info_by_name ( + const hid_t loc_id, + const hsize_t idx, + const char* name, + h5_int64_t* const type, + hsize_t* const npoints + ); #endif