functions added to query existence of file-, step-. field-attributes amd to get information by name

This commit is contained in:
2016-03-29 17:49:32 +02:00
parent bc528f27e6
commit 2c850612ab
7 changed files with 490 additions and 307 deletions
+262 -243
View File
@@ -14,203 +14,6 @@
#include "h5_readwrite_private.h"
#include "h5_hdf5_private.h"
h5_err_t
h5priv_read_attrib (
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to read */
const hid_t attrib_type, /*!< HDF5 type of attribute */
void* const attrib_value /*!< OUT: attribute value */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%d, attrib_name='%s', attrib_type=%d, attrib_value=%p",
id,
attrib_name,
attrib_type,
attrib_value);
hid_t attrib_id;
hid_t type_id;
hid_t space_id;
TRY (attrib_id = hdf5_open_attribute (id, attrib_name));
TRY (type_id = hdf5_get_attribute_type (attrib_id));
hid_t h5type_id;
TRY (h5type_id = h5priv_normalize_h5_type (type_id));
if (h5type_id != attrib_type)
H5_PRIV_API_LEAVE (
h5_error (
H5_ERR_HDF5,
"Attribute '%s' has type '%s' but was requested as '%s'.",
attrib_name,
hdf5_get_type_name (h5type_id),
hdf5_get_type_name (attrib_type)));
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
TRY (hdf5_read_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_dataspace(space_id));
TRY (hdf5_close_type (type_id));
TRY (hdf5_close_attribute (attrib_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_read_file_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
void *attrib_value
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p",
f,
attrib_name,
attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (h5priv_read_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value));
}
h5_err_t
h5_read_step_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
void *attrib_value
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p",
f,
attrib_name,
attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_CORE_API_RETURN (h5priv_read_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value));
}
h5_err_t
h5priv_write_attrib (
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to write */
const hid_t attrib_type, /*!< HDF5 type of attribute */
const void* attrib_value, /*!< value of attribute */
const hsize_t attrib_nelem, /*!< number of elements (dimension) */
const int overwrite
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%d, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p, attrib_nelem=%llu, overwrite=%d",
id,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
overwrite);
hid_t space_id;
hid_t attrib_id;
hid_t type_id;
if ( attrib_type == H5T_NATIVE_CHAR ) {
TRY (type_id = hdf5_create_string_type (attrib_nelem));
TRY (space_id = hdf5_create_dataspace_scalar ());
} else {
type_id = attrib_type;
TRY (space_id = hdf5_create_dataspace (1, &attrib_nelem, NULL));
}
h5_err_t exists;
TRY (exists = hdf5_attribute_exists (id, attrib_name));
if (exists) {
if (overwrite) {
TRY (hdf5_delete_attribute (id, attrib_name));
} else {
H5_PRIV_API_LEAVE (
h5_error (H5_ERR_H5, "Cannot overwrite attribute %s/%s",
hdf5_get_objname (id), attrib_name));
}
}
TRY (attrib_id = hdf5_create_attribute (
id,
attrib_name,
type_id,
space_id,
H5P_DEFAULT, H5P_DEFAULT));
TRY (hdf5_write_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_attribute (attrib_id));
TRY (hdf5_close_dataspace (space_id));
if (attrib_type == H5T_NATIVE_CHAR)
TRY (hdf5_close_type (type_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_write_file_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
const void *attrib_value,
const hsize_t attrib_nelem
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p, attrib_nelem=%llu",
f,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
H5_CORE_API_RETURN (h5priv_write_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
}
h5_err_t
h5_write_step_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
const void *attrib_value,
const hsize_t attrib_nelem
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p, attrib_nelem=%llu",
f,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_WRITABLE_MODE (f);
H5_CORE_API_RETURN (h5priv_write_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
}
static inline h5_err_t
get_attrib_info (
@@ -297,13 +100,130 @@ h5priv_get_attrib_info_by_idx (
H5_PRIV_API_RETURN (get_attrib_info (attrib_id, attrib_type, attrib_nelem));
}
/*!
\ingroup h5_core_attrib
h5_err_t
h5priv_read_attrib (
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to read */
const hid_t attrib_type, /*!< HDF5 type of attribute */
void* const attrib_value /*!< OUT: attribute value */
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%d, attrib_name='%s', attrib_type=%d, attrib_value=%p",
id,
attrib_name,
attrib_type,
attrib_value);
hid_t attrib_id;
hid_t type_id;
hid_t space_id;
TRY (attrib_id = hdf5_open_attribute (id, attrib_name));
TRY (type_id = hdf5_get_attribute_type (attrib_id));
Get information about an attribute of a HDF5 object.
hid_t h5type_id;
TRY (h5type_id = h5priv_normalize_h5_type (type_id));
if (h5type_id != attrib_type)
H5_PRIV_API_LEAVE (
h5_error (
H5_ERR_HDF5,
"Attribute '%s' has type '%s' but was requested as '%s'.",
attrib_name,
hdf5_get_type_name (h5type_id),
hdf5_get_type_name (attrib_type)));
TRY (space_id = hdf5_get_attribute_dataspace (attrib_id));
TRY (hdf5_read_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_dataspace(space_id));
TRY (hdf5_close_type (type_id));
TRY (hdf5_close_attribute (attrib_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5priv_write_attrib (
const hid_t id, /*!< HDF5 object ID */
const char* attrib_name, /*!< name of HDF5 attribute to write */
const hid_t attrib_type, /*!< HDF5 type of attribute */
const void* attrib_value, /*!< value of attribute */
const hsize_t attrib_nelem, /*!< number of elements (dimension) */
const int overwrite
) {
H5_PRIV_API_ENTER (h5_err_t,
"id=%d, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p, attrib_nelem=%llu, overwrite=%d",
id,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
overwrite);
hid_t space_id;
hid_t attrib_id;
hid_t type_id;
if ( attrib_type == H5T_NATIVE_CHAR ) {
TRY (type_id = hdf5_create_string_type (attrib_nelem));
TRY (space_id = hdf5_create_dataspace_scalar ());
} else {
type_id = attrib_type;
TRY (space_id = hdf5_create_dataspace (1, &attrib_nelem, NULL));
}
h5_err_t exists;
TRY (exists = hdf5_attribute_exists (id, attrib_name));
if (exists) {
if (overwrite) {
TRY (hdf5_delete_attribute (id, attrib_name));
} else {
H5_PRIV_API_LEAVE (
h5_error (H5_ERR_H5, "Cannot overwrite attribute %s/%s",
hdf5_get_objname (id), attrib_name));
}
}
TRY (attrib_id = hdf5_create_attribute (
id,
attrib_name,
type_id,
space_id,
H5P_DEFAULT, H5P_DEFAULT));
TRY (hdf5_write_attribute (attrib_id, type_id, attrib_value));
TRY (hdf5_close_attribute (attrib_id));
TRY (hdf5_close_dataspace (space_id));
if (attrib_type == H5T_NATIVE_CHAR)
TRY (hdf5_close_type (type_id));
H5_PRIV_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_has_file_attrib (
const h5_file_t f_,
const char* const attrib_name
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name='%s'",
f,
attrib_name);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_attribute_exists(f->root_gid, attrib_name));
}
h5_err_t
h5_has_step_attrib (
const h5_file_t f_,
const char* const attrib_name
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name='%s'",
f,
attrib_name);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_attribute_exists(f->step_gid, attrib_name));
}
\return \c H5_SUCCESS or error code.
*/
h5_err_t
h5_get_file_attrib_info_by_name (
const h5_file_t f_, /*!< IN: handle to open file */
@@ -327,6 +247,51 @@ h5_get_file_attrib_info_by_name (
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t f_, /*!< handle to open file */
char* attrib_name, /*!< OUT: name of attribute */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name=%p, "
"attrib_type=%p, attrib_nelem=%p",
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5priv_get_attrib_info_by_name (
f->step_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_ssize_t
h5_get_num_file_attribs (
const h5_file_t f_ /*!< handle to open file */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->root_gid));
}
h5_ssize_t
h5_get_num_step_attribs (
const h5_file_t f_ /*!< handle to open file */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->step_gid));
}
h5_err_t
h5_get_file_attrib_info_by_idx (
const h5_file_t f_, /*!< handle to open file */
@@ -353,30 +318,6 @@ h5_get_file_attrib_info_by_idx (
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t f_, /*!< handle to open file */
char* attrib_name, /*!< OUT: name of attribute */
h5_int64_t* attrib_type, /*!< OUT: H5 type of attribute */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"attrib_name=%p, "
"attrib_type=%p, attrib_nelem=%p",
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5priv_get_attrib_info_by_name (
f->step_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5_get_step_attrib_info_by_idx (
const h5_file_t f_, /*!< handle to open file */
@@ -405,31 +346,109 @@ h5_get_step_attrib_info_by_idx (
H5_CORE_API_RETURN (H5_SUCCESS);
}
/*!
\ingroup h5_core_attrib
Get number of attributes of a HDF5 object.
\return number of attributes or error code.
*/
h5_ssize_t
h5_get_num_file_attribs (
const h5_file_t f_ /*!< handle to open file */
h5_err_t
h5_read_file_attrib (
const h5_file_t f_,
const char* const attrib_name,
const hid_t attrib_type,
void* attrib_value
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p",
f,
attrib_name,
attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->root_gid));
H5_CORE_API_RETURN (h5priv_read_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value));
}
h5_ssize_t
h5_get_num_step_attribs (
const h5_file_t f_ /*!< handle to open file */
h5_err_t
h5_read_step_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
void *attrib_value
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p",
f,
attrib_name,
attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_CORE_API_RETURN (hdf5_get_num_attribute (f->step_gid));
H5_CORE_API_RETURN (h5priv_read_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value));
}
h5_err_t
h5_write_file_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
const void *attrib_value,
const hsize_t attrib_nelem
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p, attrib_nelem=%llu",
f,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
H5_CORE_API_RETURN (h5priv_write_attrib (
f->root_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
}
h5_err_t
h5_write_step_attrib (
const h5_file_t f_,
const char *attrib_name,
const hid_t attrib_type,
const void *attrib_value,
const hsize_t attrib_nelem
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%d, "
"attrib_value=%p, attrib_nelem=%llu",
f,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_WRITABLE_MODE (f);
H5_CORE_API_RETURN (h5priv_write_attrib (
f->step_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem,
!is_appendonly (f)));
}
+58
View File
@@ -87,6 +87,64 @@ h5b_read_field_attrib (
H5_CORE_API_RETURN (H5_SUCCESS);
}
h5_err_t
h5b_has_field_attrib (
const h5_file_t fh, /*!< IN: file handle */
const char* const field_name, /*!< IN: field name */
const char* const attrib_name /*!< IN: attribute name */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name=%s, ",
f,
field_name,
attrib_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5bpriv_open_field_group(f, field_name));
H5_CORE_API_RETURN (
hdf5_attribute_exists (
f->b->field_gid,
attrib_name) );
}
h5_err_t
h5b_get_field_attrib_info_by_name (
const h5_file_t fh, /*!< IN: file handle */
const char* const field_name, /*!< IN: field name */
const char* const attrib_name, /*!< IN: attribute name */
h5_int64_t* attrib_type, /*!< OUT: attribute type */
h5_size_t* attrib_nelem /*!< OUT: number of elements */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, "
"field_name='%s', "
"attrib_name=%s, "
"attrib_type=%p, "
"attrib_nelem=%p",
f,
field_name,
attrib_name,
attrib_type,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (h5bpriv_open_field_group(f, field_name));
H5_CORE_API_RETURN (
h5priv_get_attrib_info_by_name (
f->b->field_gid,
attrib_name,
attrib_type,
attrib_nelem));
}
h5_ssize_t
h5b_get_num_field_attribs (
const h5_file_t fh, /*<! IN: file handle */
+1 -1
View File
@@ -28,7 +28,7 @@
!! Query the number of attributes of field \c field_name.
!!
!! \return number of attributes
!!\return \c H5_FAILURE on error
!! \return \c H5_FAILURE on error
INTEGER*8 FUNCTION h5bl_getnfieldattribs (filehandle, field_name)
INTEGER*8, INTENT(IN) :: filehandle !< file handle
+68 -9
View File
@@ -58,12 +58,12 @@ H5BlockGetNumFieldAttribs (
}
/**
Gets the name, type and number of elements of the field attribute
Get the name, type and number of elements of the field attribute
specified by its index.
This function can be used to retrieve all attributes bound to the
specified field by looping from \c 0 to the number of attribute
minus one. The number of attributes bound to the
minus one. The number of attributes attached to the
field can be queried by calling \ref H5BlockGetNumFieldAttribs.
\return \c H5_SUCCESS on success
@@ -102,6 +102,66 @@ H5BlockGetFieldAttribInfo (
attrib_nelem));
}
/**
Determines whether a field attribute with a given name exists.
\return true (value \c >0) if atrribute exists
\return false (\c 0) if attribute does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5BlockHasFieldAttrib (
const h5_file_t f, ///< [in] file handle
const char* const field_name, ///< [in] field name
const char* const attrib_name ///< [in] name of attribute to query
) {
H5_API_ENTER (h5_err_t,
"f=%p field_name='%s', "
"attrib_name=%p, ",
(h5_file_p)f,
field_name,
attrib_name);
H5_API_RETURN (
h5b_has_field_attrib (
f,
field_name,
attrib_name));
}
/**
Get the type and number of elements of the field attribute
given by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5BlockGetFieldAttribInfoByName (
const h5_file_t f, ///< [in] file handle
const char* const field_name, ///< [in] field name
const char* const attrib_name, ///< [in] name of attribute to query
h5_int64_t* attrib_type, ///< [out] type of value
h5_size_t* attrib_nelem ///< [out] number of elements
) {
H5_API_ENTER (h5_err_t,
"f=%p field_name='%s', "
"attrib_name=%p, "
"attrib_type=%p, "
"attrib_nelem=%p",
(h5_file_p)f,
field_name,
attrib_name,
attrib_type,
attrib_nelem);
H5_API_RETURN (
h5b_get_field_attrib_info_by_name (
f,
field_name,
attrib_name,
attrib_type,
attrib_nelem));
}
/*
! _ __ _ _
! (_) / /__ ___| |_ _ __(_)_ __ __ _
@@ -185,19 +245,18 @@ H5BlockReadFieldAttribString (
*/
/**
Write float64 \c values as attribute \c attrib_name of field
\c field_name.
Attach an array of 64 bit floating point data as attribute to given field.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5BlockWriteFieldAttribFloat64 (
const h5_file_t f, ///< [in] file handle.
const char* field_name, ///< [in] field name.
const char* attrib_name, ///< [in] attribute name.
const h5_float64_t* buffer, ///< [in] attribute values.
const h5_size_t nelems ///< [in] number of elements.
const h5_file_t f, ///< [in] file handle
const char* field_name, ///< [in] attach attribute to field with this name
const char* attrib_name, ///< [in] attribute name
const h5_float64_t* buffer, ///< [in] pointer to attribute data
const h5_size_t nelems ///< [in] number of elements to write
) {
H5_API_ENTER (h5_err_t,
+53 -28
View File
@@ -40,11 +40,63 @@ extern "C" {
|_| |___/
*/
/**
Determines whether a file attribute with a given name exists.
\return true (value \c >0) if atrribute exists
\return false (\c 0) if attribute does not exist
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5HasFileAttrib (
const h5_file_t f, ///< [in] file handle
const char* const name ///< [in] name of attribute to query
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"name=%p",
(h5_file_p)f,
name);
H5_API_RETURN (
h5_has_file_attrib (
f,
name));
}
/**
Get the type and number of elements of the file attribute
given by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5GetFileAttribInfoByName (
const h5_file_t f, ///< [in] file handle.
const char* const name, ///< [in] name of attribute.
h5_int64_t* type, ///< [out] type of value..
h5_size_t* nelems ///< [out] number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"name=%s, "
"type=%p, nelems=%p",
(h5_file_p)f,
name,
type, nelems);
H5_API_RETURN (h5_get_file_attrib_info_by_name (
f,
name,
type, nelems));
}
/**
Gets the number of attributes in the file's root ("/").
\return Number of attributes
\return \c H5_FAILURE on error
\see H5GetFileAttribInfo()
*/
static inline h5_int64_t
H5GetNumFileAttribs (
@@ -58,7 +110,7 @@ H5GetNumFileAttribs (
/**
Gets the name, type and number of elements of the file attribute
specified by its index.
given by its index.
This function can be used to retrieve all attributes bound to the
file \c f by looping from \c 0 to the number of attribute minus
@@ -95,33 +147,6 @@ H5GetFileAttribInfo (
nelems));
}
/**
Get the type and number of elements of the file attribute
specified by its name.
\return \c H5_SUCCESS on success
\return \c H5_FAILURE on error
*/
static inline h5_err_t
H5GetFileAttribInfoByName (
const h5_file_t f, ///< [in] file handle.
const char* const name, ///< [in] name of attribute.
h5_int64_t* type, ///< [out] type of value..
h5_size_t* nelems ///< [out] number of elements.
) {
H5_API_ENTER (h5_err_t,
"f=%p, "
"name=%s, "
"type=%p, nelems=%p",
(h5_file_p)f,
name,
type, nelems);
H5_API_RETURN (h5_get_file_attrib_info_by_name (
f,
name,
type, nelems));
}
/*
__ _ _ _ _ _ _ _
/ _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___
+34 -26
View File
@@ -15,6 +15,40 @@
#ifdef __cplusplus
extern "C" {
#endif
h5_err_t
h5_has_file_attrib (
const h5_file_t, const char* const);
h5_err_t
h5_has_step_attrib (
const h5_file_t, const char* const);
h5_err_t
h5_get_file_attrib_info_by_name (
const h5_file_t, const char* const, h5_int64_t* const, h5_size_t*);
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t, const char* const, h5_int64_t*, h5_size_t*);
h5_ssize_t
h5_get_num_file_attribs (
const h5_file_t);
h5_ssize_t
h5_get_num_step_attribs (
const h5_file_t);
h5_err_t
h5_get_file_attrib_info_by_idx (
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t* const,
h5_size_t*);
h5_err_t
h5_get_step_attrib_info_by_idx (
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t*,
h5_size_t*);
h5_err_t
h5_read_file_attrib (
@@ -32,32 +66,6 @@ h5_err_t
h5_write_step_attrib (
const h5_file_t, const char*, const hid_t, const void*, const hsize_t);
h5_err_t
h5_get_file_attrib_info_by_name (
const h5_file_t, const char* const, h5_int64_t* const, h5_size_t*);
h5_err_t
h5_get_file_attrib_info_by_idx (
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t* const,
h5_size_t*);
h5_err_t
h5_get_step_attrib_info_by_name (
const h5_file_t, const char* const, h5_int64_t*, h5_size_t*);
h5_err_t
h5_get_step_attrib_info_by_idx (
const h5_file_t, const h5_size_t, char*, const h5_size_t, h5_int64_t*,
h5_size_t*);
h5_ssize_t
h5_get_num_file_attribs (
const h5_file_t);
h5_ssize_t
h5_get_num_step_attribs (
const h5_file_t);
#ifdef __cplusplus
}
#endif
+14
View File
@@ -35,6 +35,20 @@ h5b_read_field_attrib (
const h5_file_t,
const char*, const char*, const h5_int64_t, void* const);
h5_err_t
h5b_has_field_attrib (
const h5_file_t fh,
const char* const field_name,
const char* const attrib_name);
h5_err_t
h5b_get_field_attrib_info_by_name (
const h5_file_t,
const char* const,
const char* const,
h5_int64_t*,
h5_size_t*);
h5_ssize_t
h5b_get_num_field_attribs (
const h5_file_t,