From ad83c3841b8ceded98fff3feb9a6e106ed32ebb4 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 8 Jul 2016 17:09:16 +0200 Subject: [PATCH] C-API: - declare more args as const - H5GetFileAttribName() added --- src/include/H5Part_model.h | 2 +- src/include/H5_file.h | 32 +++++++-------- src/include/H5_file_attribs.h | 77 +++++++++++++++++++++++------------ 3 files changed, 67 insertions(+), 44 deletions(-) diff --git a/src/include/H5Part_model.h b/src/include/H5Part_model.h index 7d44ffa..a12155a 100644 --- a/src/include/H5Part_model.h +++ b/src/include/H5Part_model.h @@ -99,7 +99,7 @@ static inline h5_err_t H5PartGetDatasetInfo ( const h5_file_t f, ///< [in] file handle const h5_id_t idx, ///< [in] index of the dataset - char* name, ///< [out] name of dataset + char* const name, ///< [out] name of dataset const h5_size_t len_name, ///< [in] size of buffer \c name h5_int64_t* type, ///< [out] type of data in dataset h5_size_t* nelems ///< [out] number of elements diff --git a/src/include/H5_file.h b/src/include/H5_file.h index 0e4ed14..0d2c571 100644 --- a/src/include/H5_file.h +++ b/src/include/H5_file.h @@ -161,8 +161,8 @@ H5SetPropFileMPIOPosix ( */ static inline h5_err_t H5SetPropFileCoreVFD ( - h5_prop_t prop, ///< [in,out] identifier for file property list - h5_int64_t increment ///< [in] size, in bytes, of memory increments. + h5_prop_t prop, ///< [in,out] identifier for file property list + const h5_int64_t increment ///< [in] size, in bytes, of memory increments. ) { H5_API_ENTER (h5_err_t, "prop=%p", (void*)prop); H5_API_RETURN (h5_set_prop_file_core_vfd (prop, increment)); @@ -195,8 +195,8 @@ H5SetPropFileCoreVFD ( */ static inline h5_err_t H5SetPropFileAlign ( - h5_prop_t prop, ///< [in,out] identifier for file property list - h5_int64_t align ///< [in] alignment + h5_prop_t prop, ///< [in,out] identifier for file property list + const h5_int64_t align ///< [in] alignment ) { H5_API_ENTER (h5_err_t, "prop=%p, align=%lld", (void*)prop, (long long int)align); @@ -225,8 +225,8 @@ H5SetPropFileAlign ( */ static inline h5_err_t H5SetPropFileThrottle ( - h5_prop_t prop, ///< [in,out] identifier for file property list - h5_int64_t throttle ///< [in] throttle factor + h5_prop_t prop, ///< [in,out] identifier for file property list + const h5_int64_t throttle ///< [in] throttle factor ) { H5_API_ENTER (h5_err_t, "prop=%p, throttle=%lld", (void*)prop, (long long int)throttle); @@ -279,9 +279,9 @@ H5CloseProp ( */ static inline h5_file_t H5OpenFile2 ( - const char* filename, ///< [in] name of file - h5_int64_t mode, ///< [in] file mode - h5_prop_t props ///< [in] identifier for file property list + const char* const filename, ///< [in] name of file + const h5_int64_t mode, ///< [in] file mode + const h5_prop_t props ///< [in] identifier for file property list ) { H5_API_ENTER (h5_file_t, "filename='%s', mode=%lld, props=%p", @@ -316,9 +316,9 @@ H5OpenFile2 ( */ static inline h5_file_p H5OpenFile1 ( - const char* filename, ///< [in] file name - h5_int32_t flags, ///< [in] file open flags - MPI_Comm comm ///< [in] MPI communicator + const char* filename, ///< [in] file name + const h5_int32_t flags, ///< [in] file open flags + MPI_Comm comm ///< [in] MPI communicator ) { H5_API_ENTER (h5_file_p, "filename='%s', flags=%d, ...",filename,flags); H5_API_RETURN (h5_open_file1 (filename, flags, comm, 0)); @@ -332,7 +332,7 @@ H5OpenFile1 ( */ static inline h5_err_t H5CloseFile ( - const h5_file_t f ///< [in] file handle. + const h5_file_t f ///< [in] file handle. ) { H5_API_ENTER (h5_err_t, "f=%p", @@ -348,7 +348,7 @@ H5CloseFile ( */ static inline h5_err_t H5CheckFile ( - const h5_file_t f ///< [in] file handle. + const h5_file_t f ///< [in] file handle. ) { H5_API_ENTER (h5_err_t, "f=%p", @@ -364,7 +364,7 @@ H5CheckFile ( */ static inline h5_err_t H5FlushStep ( - const h5_file_t f ///< [in] file handle. + const h5_file_t f ///< [in] file handle. ) { H5_API_ENTER (h5_err_t, "f=%p", @@ -380,7 +380,7 @@ H5FlushStep ( */ static inline h5_err_t H5FlushFile ( - const h5_file_t f ///< [in] file handle. + const h5_file_t f ///< [in] file handle. ) { H5_API_ENTER (h5_err_t, "f=%p", diff --git a/src/include/H5_file_attribs.h b/src/include/H5_file_attribs.h index c69969d..843c3a0 100644 --- a/src/include/H5_file_attribs.h +++ b/src/include/H5_file_attribs.h @@ -68,10 +68,10 @@ 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* attrib_name, ///< [out] name of attribute + char* const attrib_name, ///< [out] name of attribute const h5_size_t len_attrib_name,///< [in] size of buffer \c attrib_name - h5_int64_t* attrib_type, ///< [out] type of value - h5_size_t* nelems ///< [out] number of elements + h5_int64_t* const attrib_type, ///< [out] type of value + h5_size_t* const nelems ///< [out] number of elements ) { H5_API_ENTER (h5_err_t, "f=%p, " @@ -92,6 +92,29 @@ H5GetFileAttribInfo ( nelems)); } +static inline h5_err_t +H5GetFileAttribName ( + const h5_file_t f, ///< [in] file handle + const h5_size_t idx, ///< [in] index of attribute to query + char* const attrib_name, ///< [out] name of attribute + const h5_size_t len_attrib_name ///< [in] size of buffer \c attrib_name + ) { + H5_API_ENTER (h5_err_t, + "f=%p, " + "idx=%llu, attrib_name=%p, len_attrib_name=%llu, ", + (h5_file_p)f, + (long long unsigned)idx, + attrib_name, + (long long unsigned)len_attrib_name); + H5_API_RETURN ( + h5_get_file_attrib_info_by_idx ( + f, + idx, + attrib_name, len_attrib_name, + NULL, + NULL)); +} + /** Determines whether a file attribute with a given name exists. @@ -126,8 +149,8 @@ static inline h5_err_t H5GetFileAttribInfoByName ( const h5_file_t f, ///< [in] file handle. const char* const attrib_name, ///< [in] name of attribute. - h5_int64_t* attrib_type, ///< [out] type of value.. - h5_size_t* nelems ///< [out] number of elements. + h5_int64_t* const attrib_type, ///< [out] type of value.. + h5_size_t* const nelems ///< [out] number of elements. ) { H5_API_ENTER (h5_err_t, "f=%p, " @@ -213,8 +236,8 @@ H5GetFileAttribInfoByName ( static inline h5_err_t H5WriteFileAttribString ( const h5_file_t f, - const char* attrib_name, - const char* buffer + const char* const attrib_name, + const char* const buffer ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffer='%s'", @@ -230,10 +253,10 @@ H5WriteFileAttribString ( static inline h5_err_t H5WriteFileAttribFloat64 ( - const h5_file_t f, ///< [in] file handle. - const char *attrib_name, ///< [in] name of attribute to create. - const h5_float64_t *buffers, ///< [in] buffers of attribute. - const h5_size_t nelems ///< [in] number of buffers. + const h5_file_t f, + const char* const attrib_name, + const h5_float64_t* const buffers, + const h5_size_t nelems ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffers=%p, nelems=%llu", @@ -250,8 +273,8 @@ H5WriteFileAttribFloat64 ( static inline h5_err_t H5WriteFileAttribFloat32 ( const h5_file_t f, - const char* attrib_name, - const h5_float32_t* buffers, + const char* const attrib_name, + const h5_float32_t* const buffers, const h5_size_t nelems ) { H5_API_ENTER (h5_err_t, @@ -269,8 +292,8 @@ H5WriteFileAttribFloat32 ( static inline h5_err_t H5WriteFileAttribInt64 ( const h5_file_t f, - const char* attrib_name, - const h5_int64_t* buffers, + const char* const attrib_name, + const h5_int64_t* const buffers, const h5_size_t nelems ) { H5_API_ENTER (h5_err_t, @@ -288,8 +311,8 @@ H5WriteFileAttribInt64 ( static inline h5_err_t H5WriteFileAttribInt32 ( const h5_file_t f, - const char* attrib_name, - const h5_int32_t* buffers, + const char* const attrib_name, + const h5_int32_t* const buffers, const h5_size_t nelems ) { H5_API_ENTER (h5_err_t, @@ -366,8 +389,8 @@ H5WriteFileAttribInt32 ( static inline h5_err_t H5ReadFileAttribString ( const h5_file_t f, - const char* attrib_name, - char* buffer + const char* const attrib_name, + char* const buffer ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffer='%s'", @@ -383,8 +406,8 @@ H5ReadFileAttribString ( static inline h5_err_t H5ReadFileAttribFloat64 ( const h5_file_t f, - const char* attrib_name, - h5_float64_t* buffer + const char* const attrib_name, + h5_float64_t* const buffer ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffer=%p", @@ -400,8 +423,8 @@ H5ReadFileAttribFloat64 ( static inline h5_err_t H5ReadFileAttribFloat32 ( const h5_file_t f, - const char* attrib_name, - h5_float32_t* buffer + const char* const attrib_name, + h5_float32_t* const buffer ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffer=%p", @@ -417,8 +440,8 @@ H5ReadFileAttribFloat32 ( static inline h5_err_t H5ReadFileAttribInt64 ( const h5_file_t f, - const char* attrib_name, - h5_int64_t* buffer + const char* const attrib_name, + h5_int64_t* const buffer ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffer=%p", @@ -434,8 +457,8 @@ H5ReadFileAttribInt64 ( static inline h5_err_t H5ReadFileAttribInt32 ( const h5_file_t f, - const char* attrib_name, - h5_int32_t* buffer + const char* const attrib_name, + h5_int32_t* const buffer ) { H5_API_ENTER (h5_err_t, "f=%p, attrib_name='%s', buffer=%p",