diff --git a/src/include/H5_attribs.h b/src/include/H5_attribs.h index bb82a4a..d87c857 100644 --- a/src/include/H5_attribs.h +++ b/src/include/H5_attribs.h @@ -21,7 +21,118 @@ extern "C" { #endif -/*** WRITE ***/ +/* + __ _ _ _ _ _ _ _ + / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ + | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| + | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ + |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + + __ _ _ _ ___ _ __ _ _ + / _` | | | |/ _ \ '__| | | | + | (_| | |_| | __/ | | |_| | + \__, |\__,_|\___|_| \__, | + |_| |___/ +*/ + +/*! + \ingroup h5hut_attrib + + Gets the number of attributes in the file's root ("/"). + + \return Number of attributes or \c H5_FAILURE.. +*/ +static inline h5_int64_t +H5GetNumFileAttribs ( + const h5_file_t f ///< [in] file handle. + ) { + H5_API_ENTER (h5_int64_t, + "f=%p", + (h5_file_p)f); + H5_API_RETURN (h5_get_num_file_attribs (f)); +} + +/*! + \ingroup h5hut_attrib + + Gets the name, type and number of elements of the file attribute + specified 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 + one. The number of attributes bound to file \c f can be queried + by calling \ref H5GetNumFileAttribs. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5GetFileAttribInfo ( + const h5_file_t f, ///< [in] file handle. + const h5_size_t idx, ///< [in] index of attribute to query + char* name, ///< [out] name of attribute. + const h5_size_t len_name, ///< [in] length of buffer \c name. + h5_int64_t* type, ///< [out] type of value.. + h5_size_t* nelems ///< [out] number of elements. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, " + "idx=%llu, name=%p, len_name=%llu, " + "type=%p, nelems=%p", + (h5_file_p)f, + (long long unsigned)idx, + name, + (long long unsigned)len_name, + type, + nelems); + H5_API_RETURN (h5_get_file_attrib_info_by_idx ( + f, + idx, + name, len_name, + type, + nelems)); +} + +/*! + \ingroup h5hut_attrib + + Get the type and number of elements of the file attribute + specified by its name. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +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)); +} + +/* + __ _ _ _ _ _ _ _ + / _(_) | ___ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ + | |_| | |/ _ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| + | _| | | __/ | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ + |_| |_|_|\___| \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + + _ __ + (_) / /__ + | | / / _ \ + | |/ / (_) | + |_/_/ \___/ +*/ /*! \ingroup h5hut_attrib @@ -51,78 +162,25 @@ H5WriteFileAttribString ( /*! \ingroup h5hut_attrib - Write an attribute \c name with the string \c value to - the current timestep. + Read a string into a \c buffer from an attribute \c name + in the file root ("/"). - \return \c H5_SUCCESS or \c H5_FAILURE. + \return \c H5_SUCCESS or \c H5_FAILURE. */ static inline h5_err_t -H5WriteStepAttribString ( - const h5_file_t f, ///< [in] file handle. +H5ReadFileAttribString ( + const h5_file_t f, ///< [in] file handle. const char *name, ///< [in] name of attribute to create. - const char *value ///< [in] value of attribute. + char *buffer ///< [out] value of attribute. ) { H5_API_ENTER (h5_err_t, "f=%p, name='%s', value='%s'", - (h5_file_p)f, name, value); - H5_API_RETURN (h5_write_step_attrib ( - f, - name, - H5T_NATIVE_CHAR, - value, - strlen(value) + 1 )); -} - -/*! - \ingroup h5hut_attrib - - Write an attribute \c name with float32 \c values to - the file root ("/"). - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5WriteFileAttribFloat32 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - const h5_float32_t *values, ///< [in] values of attribute. - const h5_size_t nelems ///< [in] number of values. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', values=%p, nelems=%llu", - (h5_file_p)f, name, values, (long long unsigned)nelems); - H5_API_RETURN (h5_write_file_attrib ( + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_file_attrib ( f, name, - H5T_NATIVE_FLOAT, - values, - nelems )); -} - -/*! - \ingroup h5hut_attrib - - Write an attribute \c name with float32 \c values to - the current time step. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5WriteStepAttribFloat32 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - const h5_float32_t *values, ///< [in] values of attribute. - const h5_size_t nelems ///< [in] number of values. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', values=%p, nelems=%llu", - (h5_file_p)f, name, values, (long long unsigned)nelems); - H5_API_RETURN (h5_write_step_attrib ( - f, - name, - H5T_NATIVE_FLOAT, - values, - nelems )); + H5_STRING_T, + (void*)buffer)); } /*! @@ -154,42 +212,41 @@ H5WriteFileAttribFloat64 ( /*! \ingroup h5hut_attrib - Write an attribute \c name with float64 \c values to - the current time step. + Read float64 values into a \c buffer from an attribute \c name + in the file root ("/"). \return \c H5_SUCCESS or \c H5_FAILURE. */ static inline h5_err_t -H5WriteStepAttribFloat64 ( +H5ReadFileAttribFloat64 ( const h5_file_t f, ///< [in] file handle. const char *name, ///< [in] name of attribute to create. - const h5_float64_t *values, ///< [in] values of attribute. - const h5_size_t nelems ///< [in] number of values. + h5_float64_t *buffer ///< [out] values of attribute. ) { H5_API_ENTER (h5_err_t, - "f=%p, name='%s', values=%p, nelems=%llu", - (h5_file_p)f, name, values, (long long unsigned)nelems); - H5_API_RETURN (h5_write_step_attrib ( + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_file_attrib ( f, name, - H5T_NATIVE_DOUBLE, - values, - nelems)); + H5_FLOAT64_T, + (void*)buffer)); } + /*! \ingroup h5hut_attrib - Write an attribute \c name with int32 \c values to + Write an attribute \c name with float32 \c values to the file root ("/"). \return \c H5_SUCCESS or \c H5_FAILURE. */ static inline h5_err_t -H5WriteFileAttribInt32 ( +H5WriteFileAttribFloat32 ( const h5_file_t f, ///< [in] file handle. const char *name, ///< [in] name of attribute to create. - const h5_int32_t *values, ///< [in] values of attribute. + const h5_float32_t *values, ///< [in] values of attribute. const h5_size_t nelems ///< [in] number of values. ) { H5_API_ENTER (h5_err_t, @@ -198,35 +255,33 @@ H5WriteFileAttribInt32 ( H5_API_RETURN (h5_write_file_attrib ( f, name, - H5T_NATIVE_INT32, + H5T_NATIVE_FLOAT, values, - nelems)); + nelems )); } /*! \ingroup h5hut_attrib - Write an attribute \c name with int32 \c values to - the current time step. + Read float32 values into a \c buffer from an attribute \c name + in the file root ("/"). \return \c H5_SUCCESS or \c H5_FAILURE. */ static inline h5_err_t -H5WriteStepAttribInt32 ( +H5ReadFileAttribFloat32 ( const h5_file_t f, ///< [in] file handle. const char *name, ///< [in] name of attribute to create. - const h5_int32_t *values, ///< [in] values of attribute. - const h5_size_t nelems ///< [in] number of values. + h5_float32_t *buffer ///< [out] values of attribute. ) { H5_API_ENTER (h5_err_t, - "f=%p, name='%s', values=%p, nelems=%llu", - (h5_file_p)f, name, values, (long long unsigned)nelems); - H5_API_RETURN (h5_write_step_attrib ( + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_file_attrib ( f, name, - H5T_NATIVE_INT32, - values, - nelems)); + H5_FLOAT32_T, + (void*)buffer)); } /*! @@ -258,77 +313,51 @@ H5WriteFileAttribInt64 ( /*! \ingroup h5hut_attrib - Write an attribute \c name with int64 \c values to - the current time step. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5WriteStepAttribInt64 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - const h5_int64_t *values, ///< [in] values of attribute. - const h5_size_t nelems ///< [in] number of values. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', values=%p, nelems=%llu", - (h5_file_p)f, name, values, (long long unsigned)nelems); - H5_API_RETURN (h5_write_step_attrib ( - f, - name, - H5T_NATIVE_INT64, - values, - nelems)); -} - -/*** READ ***/ - -/*! - \ingroup h5hut_attrib - - Read a string into a \c buffer from an attribute \c name + Read int64 values into a \c buffer from an attribute \c name in the file root ("/"). \return \c H5_SUCCESS or \c H5_FAILURE. */ static inline h5_err_t -H5ReadFileAttribString ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - char *buffer ///< [out] value of attribute. +H5ReadFileAttribInt64 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + h5_int64_t *buffer ///< [out] values of attribute. ) { H5_API_ENTER (h5_err_t, - "f=%p, name='%s', value='%s'", - (h5_file_p)f, name, buffer); + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); H5_API_RETURN (h5_read_file_attrib ( f, name, - H5_STRING_T, + H5_INT64_T, (void*)buffer)); } /*! \ingroup h5hut_attrib - Read a string into a \c buffer from an attribute \c name - in the current timestep. + Write an attribute \c name with int32 \c values to + the file root ("/"). \return \c H5_SUCCESS or \c H5_FAILURE. */ static inline h5_err_t -H5ReadStepAttribString ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - char *buffer ///< [out] value of attribute. +H5WriteFileAttribInt32 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + const h5_int32_t *values, ///< [in] values of attribute. + const h5_size_t nelems ///< [in] number of values. ) { H5_API_ENTER (h5_err_t, - "f=%p, name='%s', value='%s'", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_step_attrib ( - f, + "f=%p, name='%s', values=%p, nelems=%llu", + (h5_file_p)f, name, values, (long long unsigned)nelems); + H5_API_RETURN (h5_write_file_attrib ( + f, name, - H5_STRING_T, - (void*)buffer)); + H5T_NATIVE_INT32, + values, + nelems)); } /*! @@ -355,193 +384,20 @@ H5ReadFileAttribInt32 ( (void*)buffer)); } -/*! - \ingroup h5hut_attrib - - Read int32 values into a \c buffer from an attribute \c name - in the current time step. - - \return \c H5_SUCCESS or \c H5_FAILURE. +/* + _ _ _ _ _ _ + ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ + / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| + \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ + |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + |_| + + __ _ _ _ ___ _ __ _ _ + / _` | | | |/ _ \ '__| | | | + | (_| | |_| | __/ | | |_| | + \__, |\__,_|\___|_| \__, | + |_| |___/ */ -static inline h5_err_t -H5ReadStepAttribInt32 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_int32_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_step_attrib ( - f, - name, - H5_INT32_T, - (void*)buffer)); -} - -/*! - \ingroup h5hut_attrib - - Read int64 values into a \c buffer from an attribute \c name - in the file root ("/"). - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5ReadFileAttribInt64 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_int64_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_file_attrib ( - f, - name, - H5_INT64_T, - (void*)buffer)); -} - -/*! - \ingroup h5hut_attrib - - Read int64 values into a \c buffer from an attribute \c name - in the current time step. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5ReadStepAttribInt64 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_int64_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - h5_err_t h5err = h5_read_step_attrib ( - f, - name, - H5_INT64_T, - (void*)buffer); - H5_API_RETURN (h5err); -} - -/*! - \ingroup h5hut_attrib - - Read float32 values into a \c buffer from an attribute \c name - in the file root ("/"). - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5ReadFileAttribFloat32 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_float32_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_file_attrib ( - f, - name, - H5_FLOAT32_T, - (void*)buffer)); -} - -/*! - \ingroup h5hut_attrib - - Read float32 values into a \c buffer from an attribute \c name - in the current time step. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5ReadStepAttribFloat32 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_float32_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_step_attrib ( - f, - name, - H5_FLOAT32_T, - (void*)buffer)); -} - -/*! - \ingroup h5hut_attrib - - Read float64 values into a \c buffer from an attribute \c name - in the file root ("/"). - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5ReadFileAttribFloat64 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_float64_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_file_attrib ( - f, - name, - H5_FLOAT64_T, - (void*)buffer)); -} - -/*! - \ingroup h5hut_attrib - - Read float64 values into a \c buffer from an attribute \c name - in the current time step. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5ReadStepAttribFloat64 ( - const h5_file_t f, ///< [in] file handle. - const char *name, ///< [in] name of attribute to create. - h5_float64_t *buffer ///< [out] values of attribute. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, name='%s', buffer=%p", - (h5_file_p)f, name, buffer); - H5_API_RETURN (h5_read_step_attrib ( - f, - name, - H5_FLOAT64_T, - (void*)buffer)); -} - -/*** QUERY ***/ - -/*! - \ingroup h5hut_attrib - - Gets the number of attributes in the file's root ("/"). - - \return Number of attributes or \c H5_FAILURE.. -*/ -static inline h5_int64_t -H5GetNumFileAttribs ( - const h5_file_t f ///< [in] file handle. - ) { - H5_API_ENTER (h5_int64_t, - "f=%p", - (h5_file_p)f); - H5_API_RETURN (h5_get_num_file_attribs (f)); -} /*! \ingroup h5hut_attrib @@ -560,104 +416,6 @@ H5GetNumStepAttribs ( H5_API_RETURN (h5_get_num_step_attribs (f)); } -/*! - \ingroup h5hut_attrib - - Get the type and number of elements of the file attribute - specified by its name. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ - -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)); -} - -/*! - \ingroup h5hut_attrib - - Gets the name, type and number of elements of the file attribute - specified 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 - one. The number of attributes bound to file \c f can be queried - by calling \ref H5GetNumFileAttribs. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ - -static inline h5_err_t -H5GetFileAttribInfo ( - const h5_file_t f, ///< [in] file handle. - const h5_size_t idx, ///< [in] index of attribute to query - char* name, ///< [out] name of attribute. - const h5_size_t len_name, ///< [in] length of buffer \c name. - h5_int64_t* type, ///< [out] type of value.. - h5_size_t* nelems ///< [out] number of elements. - ) { - H5_API_ENTER (h5_err_t, - "f=%p, " - "idx=%llu, name=%p, len_name=%llu, " - "type=%p, nelems=%p", - (h5_file_p)f, - (long long unsigned)idx, - name, - (long long unsigned)len_name, - type, - nelems); - H5_API_RETURN (h5_get_file_attrib_info_by_idx ( - f, - idx, - name, len_name, - type, - nelems)); -} - -/*! - \ingroup h5hut_attrib - - Gets the type and number of elements of the step attribute - specified by its name. - - \return \c H5_SUCCESS or \c H5_FAILURE. -*/ -static inline h5_err_t -H5GetStepAttribInfoByName ( - 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_step_attrib_info_by_name ( - f, - name, - type, nelems)); -} - /*! \ingroup h5hut_attrib @@ -699,6 +457,300 @@ H5GetStepAttribInfo ( nelems)); } +/*! + \ingroup h5hut_attrib + + Gets the type and number of elements of the step attribute + specified by its name. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5GetStepAttribInfoByName ( + 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_step_attrib_info_by_name ( + f, + name, + type, nelems)); +} + +/* + _ _ _ _ _ _ + ___| |_ ___ _ __ __ _| |_| |_ _ __(_) |__ _ _| |_ ___ ___ + / __| __/ _ \ '_ \ / _` | __| __| '__| | '_ \| | | | __/ _ \/ __| + \__ \ || __/ |_) | | (_| | |_| |_| | | | |_) | |_| | || __/\__ \ + |___/\__\___| .__/ \__,_|\__|\__|_| |_|_.__/ \__,_|\__\___||___/ + |_| + + _ __ + (_) / /__ + | | / / _ \ + | |/ / (_) | + |_/_/ \___/ +*/ + +/*! + \ingroup h5hut_attrib + + Write an attribute \c name with the string \c value to + the current timestep. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5WriteStepAttribString ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + const char *value ///< [in] value of attribute. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', value='%s'", + (h5_file_p)f, name, value); + H5_API_RETURN (h5_write_step_attrib ( + f, + name, + H5T_NATIVE_CHAR, + value, + strlen(value) + 1 )); +} + +/*! + \ingroup h5hut_attrib + + Read a string into a \c buffer from an attribute \c name + in the current timestep. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5ReadStepAttribString ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + char *buffer ///< [out] value of attribute. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', value='%s'", + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_step_attrib ( + f, + name, + H5_STRING_T, + (void*)buffer)); +} + +/*! + \ingroup h5hut_attrib + + Write an attribute \c name with float64 \c values to + the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5WriteStepAttribFloat64 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + const h5_float64_t *values, ///< [in] values of attribute. + const h5_size_t nelems ///< [in] number of values. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', values=%p, nelems=%llu", + (h5_file_p)f, name, values, (long long unsigned)nelems); + H5_API_RETURN (h5_write_step_attrib ( + f, + name, + H5T_NATIVE_DOUBLE, + values, + nelems)); +} + +/*! + \ingroup h5hut_attrib + + Read float64 values into a \c buffer from an attribute \c name + in the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5ReadStepAttribFloat64 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + h5_float64_t *buffer ///< [out] values of attribute. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_step_attrib ( + f, + name, + H5_FLOAT64_T, + (void*)buffer)); +} + +/*! + \ingroup h5hut_attrib + + Write an attribute \c name with float32 \c values to + the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5WriteStepAttribFloat32 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + const h5_float32_t *values, ///< [in] values of attribute. + const h5_size_t nelems ///< [in] number of values. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', values=%p, nelems=%llu", + (h5_file_p)f, name, values, (long long unsigned)nelems); + H5_API_RETURN (h5_write_step_attrib ( + f, + name, + H5T_NATIVE_FLOAT, + values, + nelems )); +} + +/*! + \ingroup h5hut_attrib + + Read float32 values into a \c buffer from an attribute \c name + in the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5ReadStepAttribFloat32 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + h5_float32_t *buffer ///< [out] values of attribute. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_step_attrib ( + f, + name, + H5_FLOAT32_T, + (void*)buffer)); +} + +/*! + \ingroup h5hut_attrib + + Write an attribute \c name with int64 \c values to + the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5WriteStepAttribInt64 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + const h5_int64_t *values, ///< [in] values of attribute. + const h5_size_t nelems ///< [in] number of values. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', values=%p, nelems=%llu", + (h5_file_p)f, name, values, (long long unsigned)nelems); + H5_API_RETURN (h5_write_step_attrib ( + f, + name, + H5T_NATIVE_INT64, + values, + nelems)); +} + +/*! + \ingroup h5hut_attrib + + Read int64 values into a \c buffer from an attribute \c name + in the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5ReadStepAttribInt64 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + h5_int64_t *buffer ///< [out] values of attribute. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); + h5_err_t h5err = h5_read_step_attrib ( + f, + name, + H5_INT64_T, + (void*)buffer); + H5_API_RETURN (h5err); +} + +/*! + \ingroup h5hut_attrib + + Write an attribute \c name with int32 \c values to + the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5WriteStepAttribInt32 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + const h5_int32_t *values, ///< [in] values of attribute. + const h5_size_t nelems ///< [in] number of values. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', values=%p, nelems=%llu", + (h5_file_p)f, name, values, (long long unsigned)nelems); + H5_API_RETURN (h5_write_step_attrib ( + f, + name, + H5T_NATIVE_INT32, + values, + nelems)); +} + +/*! + \ingroup h5hut_attrib + + Read int32 values into a \c buffer from an attribute \c name + in the current time step. + + \return \c H5_SUCCESS or \c H5_FAILURE. +*/ +static inline h5_err_t +H5ReadStepAttribInt32 ( + const h5_file_t f, ///< [in] file handle. + const char *name, ///< [in] name of attribute to create. + h5_int32_t *buffer ///< [out] values of attribute. + ) { + H5_API_ENTER (h5_err_t, + "f=%p, name='%s', buffer=%p", + (h5_file_p)f, name, buffer); + H5_API_RETURN (h5_read_step_attrib ( + f, + name, + H5_INT32_T, + (void*)buffer)); +} + + #ifdef __cplusplus } #endif