Skip to content

Commit

Permalink
Add doxygen comments in H5Ppublic.h (#375)
Browse files Browse the repository at this point in the history
* Add doxygen comments in H5Ppublic.h

* H5Pset_meta_block_size
* H5Pset_metadata_read_attempts
* H5Pset_multi_type
* H5Pset_object_flush_cb
* H5Pset_sieve_buf_size
* H5Pset_small_data_block_size
* H5Pset_all_coll_metadata_ops
* H5Pget_all_coll_metadata_ops

* Add DOXYGEN_EXAMPLES_DIR to src/CMakeLists.txt

* Fix clang-format errors

* Fix filenames in doxygen/examples
  • Loading branch information
ChristopherHogan authored Feb 25, 2021
1 parent a9ee5b9 commit 06c9ebe
Show file tree
Hide file tree
Showing 10 changed files with 528 additions and 2 deletions.
3 changes: 3 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@
./doxygen/dox/H5Ovisit.dox
./doxygen/dox/H5Sencode.dox
./doxygen/dox/mainpage.dox
./doxygen/dox/maybe_metadata_reads.dox
./doxygen/dox/rm-template.dox
./doxygen/examples/H5Fclose.c
./doxygen/examples/H5Fcreate.c
./doxygen/examples/H5Pset_metadata_read_attempts.c
./doxygen/examples/H5Pset_object_flush_cb.c
./doxygen/examples/hello_hdf5.c
./doxygen/img/HDFG-logo.png

Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then
AC_SUBST([DOXYGEN_OPTIMIZE_OUTPUT_FOR_C])
AC_SUBST([DOXYGEN_MACRO_EXPANSION])
AC_SUBST([DOXYGEN_OUTPUT_DIRECTORY])
AC_SUBST([DOXYGEN_EXAMPLES_DIRECTORY])

DOXYGEN_PACKAGE=${PACKAGE_NAME}
DOXYGEN_VERSION_STRING=${PACKAGE_VERSION}
Expand All @@ -1126,6 +1127,7 @@ if test "X$HDF5_DOXYGEN" = "Xyes"; then
DOXYGEN_OPTIMIZE_OUTPUT_FOR_C=YES
DOXYGEN_MACRO_EXPANSION=YES
DOXYGEN_OUTPUT_DIRECTORY=hdf5lib_docs
DOXYGEN_EXAMPLES_DIRECTORY='$(SRCDIR)/doxygen/examples'

DX_INIT_DOXYGEN([HDF5], [../doxygen/Doxyfile], [hdf5lib_docs])

Expand Down
4 changes: 2 additions & 2 deletions doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH = ../src ../examples ../test examples
EXAMPLE_PATH = ../src ../examples ../test @DOXYGEN_EXAMPLES_DIRECTORY@

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Expand Down Expand Up @@ -2175,7 +2175,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = H5_HAVE_PARALLEL

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
7 changes: 7 additions & 0 deletions doxygen/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ ALIASES += op{1}="\param[in] \1 Callback function"
ALIASES += op_data="\param[in,out] op_data User-defined callback function context"
ALIASES += op_data{1}="\param[in,out] \1 User-defined callback function context"

ALIASES += op_data_in="\param[in] op_data User-defined callback function context"
ALIASES += op_data_in{1}="\param[in] \1 User-defined callback function context"

################################################################################
# Attributes
################################################################################
Expand Down Expand Up @@ -128,6 +131,9 @@ ALIASES += dcpl_id{1}="\param[in] \1 Dataset creation property list identifier"
ALIASES += dxpl_id="\param[in] dxpl_id Dataset transfer property list identifier"
ALIASES += dxpl_id{1}="\param[in] \1 Dataset transfer property list identifier"

ALIASES += gacpl_id="\param[in] plist_id File, group, dataset, datatype, link, or attribute access property list identifier"
ALIASES += gacpl_id{1}="\param[in] \1 File, group, dataset, datatype, link, or attribute access property list identifier"

ALIASES += gapl_id="\param[in] gapl_id Group access property list identifier"
ALIASES += gapl_id{1}="\param[in] \1 Group access property list identifier"

Expand Down Expand Up @@ -189,6 +195,7 @@ ALIASES += es_id="\param[in] es_id The event set ID to add this asynchronous ope
ALIASES += estack_id="\param[in] estack_id Error stack identifier"
ALIASES += estack_id{1}="\param[in] \1 Error stack identifier"
ALIASES += cpp_c_api_note="\note \Bold{C++ Developers using HDF5 C-API functions beware:}\n If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine should be returned from normally. Examples of this kind of routine include callbacks such as H5Pset_elink_cb() and H5Pset_type_conv_cb() and functions such as H5Tconvert() and H5Ewalk2().\n Exiting the routine in its normal fashion allows the HDF5 C library to clean up its work properly. In other words, if the C++ application jumps out of the routine back to the C++ \c catch statement, the library is not given the opportunity to close any temporary data structures that were set up when the routine was called. The C++ application should save some state as the routine is started so that any problem that occurs might be diagnosed."
ALIASES += sa_metadata_ops="\sa \li H5Pget_all_coll_metadata_ops() \li H5Pget_coll_metadata_write() \li H5Pset_all_coll_metadata_ops() \li H5Pset_coll_metadata_write() \li \ref maybe_metadata_reads"

################################################################################
# The Usual Suspects
Expand Down
82 changes: 82 additions & 0 deletions doxygen/dox/maybe_metadata_reads.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* \page maybe_metadata_reads Functions with No Access Property List Parameter that May Generate Metadata Reads
*
* \ingroup GACPL
*
* Currently there are several operations in HDF5 that can issue metadata reads
* from the metadata cache, but that take no property list. It is therefore not
* possible to set a collective requirement individually for those operations. The
* only solution with the HDF5 1.10.0 release is to set the collective requirement
* globally on H5Fopen() or H5Fcreate() for all metadata operations to be
* collective.
*
* The following is a list of those functions in the HDF5 library. This list is
* integral to the discussion in the H5Pset_all_coll_metadata_ops() entry:
*
* <pre>
*
* H5Awrite()
* H5Aread()
* H5Arename()
* H5Aiterate2()
* H5Adelete()
* H5Aexists()
*
* H5Dget_space_status()
* H5Dget_storage_size()
* H5Dset_extent()
* H5Ddebug()
* H5Dclose()
* H5Dget_create_plist()
* H5Dget_space() (when dataset is a virtual dataset)
*
* H5Gget_create_plist()
* H5Gget_info()
* H5Gclose()
*
* H5Literate()
* H5Lvisit()
*
* H5Rcreate()
* H5Rdereference2() (when reference is an object reference)
* H5Rget_region()
* H5Rget_obj_type2()
* H5Rget_name()
*
* H5Ocopy()
* H5Oopen_by_addr()
* H5Oincr_refcount()
* H5Odecr_refcount()
* H5Oget_info()
* H5Oset_comment()
* H5Ovisit()
*
* H5Fis_hdf5()
* H5Fflush()
* H5Fclose()
* H5Fget_file_image()
* H5Freopen()
* H5Fget_freespace()
* H5Fget_info2()
* H5Fget_free_sections()
* H5Fmount()
* H5Funmount()
*
* H5Iget_name()
*
* H5Tget_create_plist()
* H5Tclose()
*
* H5Zunregister()
* </pre>
*
* In addition, \b most deprecated functions fall into this category.
*
* The HDF Group may address the above limitation in a future major release, but
* no decision has been made at this time. Such a change might, for example,
* include adding new versions of some or all the above functions with an extra
* property list parameter to allow an individual setting for the collective
* calling requirement.
*
* \sa_metadata_ops
*/
59 changes: 59 additions & 0 deletions doxygen/examples/H5Pset_metadata_read_attempts.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//! [SWMR Access]
/* Create a copy of file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);

/* Set the # of read attempts */
H5Pset_metadata_read_attempts(fapl, 20);

/* Open the file with SWMR access and the non-default file access property list */
fid = H5Fopen(FILE, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl);

/* Get the file's file access roperty list */
file_fapl = H5Fget_access_plist(fid);

/* Retrieve the # of read attempts from the file's file access property list */
H5Pget_metadata_read_attempts(file_fapl, &attempts);

/*
* The value returned in "attempts" will be 20.
* The library will use 20 as the number of read attempts
* when reading checksummed metadata in the file
*/

/* Close the property list */
H5Pclose(fapl);
H5Pclose(file_fapl);

/* Close the file */
H5Fclose(fid);
//! [SWMR Access]

//! [non-SWMR Access]
/* Create a copy of file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);

/* Set the # of read attempts */
H5Pset_metadata_read_attempts(fapl, 20);

/* Open the file with SWMR access and the non-default file access property list */
fid = H5Fopen(FILE, H5F_ACC_RDONLY, fapl);

/* Get the file's file access roperty list */
file_fapl = H5Fget_access_plist(fid);

/* Retrieve the # of read attempts from the file's file access property list */
H5Pget_metadata_read_attempts(file_fapl, &attempts);

/*
* The value returned in "attempts" will be 1 (default for non-SWMR access).
* The library will use 1 as the number of read attempts
* when reading checksummed metadata in the file
*/

/* Close the property lists */
H5Pclose(fapl);
H5Pclose(file_fapl);

/* Close the file */
H5Fclose(fid);
//! [non-SWMR Access]
41 changes: 41 additions & 0 deletions doxygen/examples/H5Pset_object_flush_cb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
hid_t file_id, fapl_id;
hid_t dataset_id, dapl_id;
unsigned counter;

/* Create a copy of the file access property list */
fapl_id = H5Pcreate(H5P_FILE_ACCESS);

/* Set up the object flush property values */
/* flush_cb: callback function to invoke when an object flushes (see below) */
/* counter: user data to pass along to the callback function */
H5Pset_object_flush_cb(fapl_id, flush_cb, &counter);

/* Open the file */
file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT);

/* Create a group */
gid = H5Gcreate2(fid, “group”, H5P_DEFAULT, H5P_DEFAULT_H5P_DEFAULT);

/* Open a dataset */
dataset_id = H5Dopen2(file_id, DATASET, H5P_DEFAULT);

/* The flush will invoke flush_cb() with counter */
H5Dflush(dataset_id);
/* counter will be equal to 1 */

/* ... */

/* The flush will invoke flush_cb() with counter */
H5Gflush(gid);
/* counter will be equal to 2 */

/* ... */

/* The callback function for object flush property */
static herr_t
flush_cb(hid_t obj_id, void *_udata)
{
unsigned *flush_ct = (unsigned *)_udata;
++(*flush_ct);
return 0;
}
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@ if (DOXYGEN_FOUND)
set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
set (DOXYGEN_MACRO_EXPANSION YES)
set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs)
set (DOXYGEN_EXAMPLES_DIRECTORY ${HDF5_DOXYGEN_DIR}/examples)

# Replace variables inside @@ with the current values
configure_file(${HDF5_DOXYGEN_DIR}/Doxyfile.in Doxyfile @ONLY)
Expand Down
2 changes: 2 additions & 0 deletions src/H5Pmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
* \ingroup H5P
* \defgroup OCPPL Object Copy Properties
* \ingroup H5P
* \defgroup GACPL General Access Properties
* \ingroup H5P
*/

#endif /* _H5Pmodule_H */
Loading

0 comments on commit 06c9ebe

Please sign in to comment.