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
+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,