diff options
Diffstat (limited to 'src')
48 files changed, 19502 insertions, 1424 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 149f6fd..f9eef06 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1386,8 +1386,8 @@ endif () # Option to build documentation #----------------------------------------------------------------------------- if (DOXYGEN_FOUND) - set (DOXYGEN_PACKAGE ${HDF5_PACKAGE}) - set (DOXYGEN_VERSION_STRING ${HDF5_VERSION_STRING}) + set (DOXYGEN_PACKAGE ${HDF5_PACKAGE_NAME}) + set (DOXYGEN_VERSION_STRING ${HDF5_PACKAGE_VERSION_STRING}) set (DOXYGEN_INCLUDE_ALIASES_PATH ${HDF5_DOXYGEN_DIR}) set (DOXYGEN_INCLUDE_ALIASES aliases) set (DOXYGEN_VERBATIM_VARS DOXYGEN_INCLUDE_ALIASES) @@ -1397,7 +1397,15 @@ 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) + set (DOXYGEN_EXAMPLES_DIRECTORY "${HDF5_DOXYGEN_DIR}/examples ${HDF5_SRC_DIR} ${HDF5_SOURCE_DIR}/examples ${HDF5_TEST_SRC_DIR}") + set (DOXYGEN_LAYOUT_FILE ${HDF5_DOXYGEN_DIR}/hdf5doxy_layout.xml) + set (DOXYGEN_HTML_HEADER ${HDF5_DOXYGEN_DIR}/hdf5_header.html) + set (DOXYGEN_HTML_FOOTER ${HDF5_DOXYGEN_DIR}/hdf5_footer.html) + set (DOXYGEN_HTML_EXTRA_STYLESHEET ${HDF5_DOXYGEN_DIR}/hdf5doxy.css) + set (DOXYGEN_HTML_EXTRA_FILES "${HDF5_DOXYGEN_DIR}/hdf5_navtree_hacks.js ${HDF5_DOXYGEN_DIR}/img/ftv2node.png ${HDF5_DOXYGEN_DIR}/img/ftv2pnode.png") + set (DOXYGEN_SERVER_BASED_SEARCH NO) + set (DOXYGEN_EXTERNAL_SEARCH NO) + set (DOXYGEN_SEARCHENGINE_URL) # This configure and custom target work together # Replace variables inside @@ with the current values diff --git a/src/H5ACpublic.h b/src/H5ACpublic.h index e6cebff..f8f4f28 100644 --- a/src/H5ACpublic.h +++ b/src/H5ACpublic.h @@ -442,124 +442,347 @@ extern "C" { #define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0 #define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1 +/** + * H5AC_cache_config_t is a public structure intended for use in public APIs. + * At least in its initial incarnation, it is basically a copy of \c struct + * \c H5C_auto_size_ctl_t, minus the \c report_fcn field, and plus the + * \c dirty_bytes_threshold field. + * + * The \c report_fcn field is omitted, as including it would require us to make + * \c H5C_t structure public. + * + * The \c dirty_bytes_threshold field does not appear in \c H5C_auto_size_ctl_t, + * as synchronization between caches on different processes is handled at the \c + * H5AC level, not at the level of \c H5C. Note however that there is + * considerable interaction between this value and the other fields in this + * structure. + * + * Similarly, the \c open_trace_file, \c close_trace_file, and \c + * trace_file_name fields do not appear in \c H5C_auto_size_ctl_t, as most trace + * file issues are handled at the \c H5AC level. The one exception is storage + * of the pointer to the trace file, which is handled by \c H5C. + * + * The structure is in H5ACpublic.h as we may wish to allow different + * configuration options for metadata and raw data caches. + */ + +//! <!-- [H5AC_cache_config_t_snip] --> typedef struct H5AC_cache_config_t { /* general configuration fields: */ + //! <!-- [H5AC_cache_config_t_general_snip] --> int version; + /**< Integer field indicating the the version of the H5AC_cache_config_t + * in use. This field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION + * (defined in H5ACpublic.h). */ hbool_t rpt_fcn_enabled; + /**< Boolean flag indicating whether the adaptive cache resize report + * function is enabled. This field should almost always be set to disabled + * (0). Since resize algorithm activity is reported via stdout, it MUST be + * set to disabled (0) on Windows machines.\n + * The report function is not supported code, and can be expected to change + * between versions of the library. Use it at your own risk. */ hbool_t open_trace_file; + /**< Boolean field indicating whether the + * \ref H5AC_cache_config_t.trace_file_name "trace_file_name" + * field should be used to open a trace file for the cache.\n + * The trace file is a debugging feature that allows the capture + * of top level metadata cache requests for purposes of debugging + * and/or optimization. This field should normally be set to 0, as + * trace file collection imposes considerable overhead.\n + * This field should only be set to 1 when the + * \ref H5AC_cache_config_t.trace_file_name "trace_file_name" + * contains the full path of the desired trace file, and either + * there is no open trace file on the cache, or the + * \ref H5AC_cache_config_t.close_trace_file "close_trace_file" + * field is also 1.\n + * The trace file feature is unsupported unless used at the + * direction of The HDF Group. It is intended to allow The HDF + * Group to collect a trace of cache activity in cases of occult + * failures and/or poor performance seen in the field, so as to aid + * in reproduction in the lab. If you use it absent the direction + * of The HDF Group, you are on your own. */ + hbool_t close_trace_file; - char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1]; + /**< Boolean field indicating whether the current trace file + *(if any) should be closed.\n + * See the above comments on the \ref H5AC_cache_config_t.open_trace_file + * "open_trace_file" field. This field should be set to 0 unless there is + * an open trace file on the cache that you wish to close.\n + * The trace file feature is unsupported unless used at the direction of + * The HDF Group. It is intended to allow The HDF Group to collect a trace + * of cache activity in cases of occult failures and/or poor performance + * seen in the field, so as to aid in reproduction in the lab. If you use + * it absent the direction of The HDF Group, you are on your own. */ + + char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1]; + /**< Full path of the trace file to be opened if the + * \ref H5AC_cache_config_t.open_trace_file "open_trace_file" field is set + * to 1.\n + * In the parallel case, an ascii representation of the MPI rank of the + * process will be appended to the file name to yield a unique trace file + * name for each process.\n + * The length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN + * characters.\n + * The trace file feature is unsupported unless used at the direction of + * The HDF Group. It is intended to allow The HDF Group to collect a trace + * of cache activity in cases of occult failures and/or poor performance + * seen in the field, so as to aid in reproduction in the lab. If you use + * it absent the direction of The HDF Group, you are on your own. */ hbool_t evictions_enabled; + /**< A boolean flag indicating whether evictions from the metadata cache + * are enabled. This flag is initially set to enabled (1).\n + * In rare circumstances, the raw data throughput quirements may be so high + * that the user wishes to postpone metadata writes so as to reserve I/O + * throughput for raw data. The \p evictions_enabled field exists to allow + * this. However, this is an extreme step, and you have no business doing + * it unless you have read the User Guide section on metadata caching, and + * have considered all other options carefully.\n + * The \p evictions_enabled field may not be set to disabled (0) + * unless all adaptive cache resizing code is disabled via the + * \ref H5AC_cache_config_t.incr_mode "incr_mode", + * \ref H5AC_cache_config_t.flash_incr_mode "flash_incr_mode", + * \ref H5AC_cache_config_t.decr_mode "decr_mode" fields.\n + * When this flag is set to disabled (\c 0), the metadata cache will not + * attempt to evict entries to make space for new entries, and thus will + * grow without bound.\n + * Evictions will be re-enabled when this field is set back to \c 1. + * This should be done as soon as possible. */ hbool_t set_initial_size; - size_t initial_size; + /**< Boolean flag indicating whether the cache should be created + * with a user specified initial size. */ + + size_t initial_size; + /**< If \ref H5AC_cache_config_t.set_initial_size "set_initial_size" + * is set to 1, \p initial_size must contain he desired initial size in + * bytes. This value must lie in the closed interval + * [ \p min_size, \p max_size ]. (see below) */ double min_clean_fraction; + /**< This field specifies the minimum fraction of the cache + * that must be kept either clean or empty.\n + * The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to + * start in the serial case. In the parallel case, a larger value is needed + * -- see the overview of the metadata cache in the + * “Metadata Caching in HDF5” section of the -- <em>HDF5 User’s Guide</em> + * for details. */ size_t max_size; + /**< Upper bound (in bytes) on the range of values that the + * adaptive cache resize code can select as the maximum cache size. */ + size_t min_size; + /**< Lower bound (in bytes) on the range of values that the + * adaptive cache resize code can select as the mininum cache * size. */ long int epoch_length; + /**< Number of cache accesses between runs of the adaptive cache resize + * code. 50,000 is a good starting number. */ + //! <!-- [H5AC_cache_config_t_general_snip] --> /* size increase control fields: */ + //! <!-- [H5AC_cache_config_t_incr_snip] --> enum H5C_cache_incr_mode incr_mode; + /**< Enumerated value indicating the operational mode of the automatic + * cache size increase code. At present, only two values listed in + * #H5C_cache_incr_mode are legal. */ double lower_hr_threshold; + /**< Hit rate threshold used by the hit rate threshold cache size + * increment algorithm.\n + * When the hit rate over an epoch is below this threshold and the cache + * is full, the maximum size of the cache is multiplied by increment + * (below), and then clipped as necessary to stay within \p max_size, and + * possibly \p max_increment.\n + * This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good + * place to start. */ double increment; + /**< Factor by which the hit rate threshold cache size increment + * algorithm multiplies the current cache max size to obtain a tentative + * new cache size.\n + * The actual cache size increase will be clipped to satisfy the \p max_size + * specified in the general configuration, and possibly max_increment + * below.\n + * The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable + * value.\n + * If you set it to 1.0, you will effectively disable cache size increases. + */ hbool_t apply_max_increment; - size_t max_increment; + /**< Boolean flag indicating whether an upper limit should be applied to + * the size of cache size increases. */ + + size_t max_increment; + /**< Maximum number of bytes by which cache size can be increased in a + * single step -- if applicable. */ enum H5C_cache_flash_incr_mode flash_incr_mode; - double flash_multiple; - double flash_threshold; + /**< Enumerated value indicating the operational mode of the flash cache + * size increase code. At present, only two listed values in + * #H5C_cache_flash_incr_mode are legal.*/ + + double flash_multiple; + /**< The factor by which the size of the triggering entry / entry size + * increase is multiplied to obtain the initial cache size increment. This + * increment may be reduced to reflect existing free space in the cache and + * the \p max_size field above.\n + * The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good + * place to start.\n + * At present, this field must lie in the range [0.1, 10.0]. */ + + double flash_threshold; + /**< The factor by which the current maximum cache size is multiplied to + * obtain the minimum size entry / entry size increase which may trigger a + * flash cache size increase. \n + * At present, this value must lie in the range [0.1, 1.0]. */ + //! <!-- [H5AC_cache_config_t_incr_snip] --> /* size decrease control fields: */ + //! <!-- [H5AC_cache_config_t_decr_snip] --> enum H5C_cache_decr_mode decr_mode; + /**< Enumerated value indicating the operational mode of the tomatic + * cache size decrease code. At present, the values listed in + * #H5C_cache_decr_mode are legal.*/ double upper_hr_threshold; + /**< Hit rate threshold for the hit rate threshold and ageout with hit + * rate threshold cache size decrement algorithms.\n + * When \p decr_mode is #H5C_decr__threshold, and the hit rate over a given + * epoch exceeds the supplied threshold, the current maximum cache + * size is multiplied by decrement to obtain a tentative new (and smaller) + * maximum cache size.\n + * When \p decr_mode is #H5C_decr__age_out_with_threshold, there is + * no attempt to find and evict aged out entries unless the hit rate in + * the previous epoch exceeded the supplied threshold.\n + * This field must lie in the interval [0.0, 1.0].\n + * For #H5C_incr__threshold, .9995 or .99995 is a good place to start.\n + * For #H5C_decr__age_out_with_threshold, .999 might be more useful.*/ double decrement; + /**< In the hit rate threshold cache size decrease algorithm, this + * parameter contains the factor by which the current max cache size is + * multiplied to produce a tentative new cache size.\n + * The actual cache size decrease will be clipped to satisfy the + * \ref H5AC_cache_config_t.min_size "min_size" specified in the general + * configuration, and possibly \ref H5AC_cache_config_t.max_decrement + * "max_decrement".\n + * The parameter must be be in the interval [0.0, 1.0].\n + * If you set it to 1.0, you will effectively + * disable cache size decreases. 0.9 is a reasonable starting point. */ hbool_t apply_max_decrement; - size_t max_decrement; + /**< Boolean flag indicating ether an upper limit should be applied to + * the size of cache size decreases. */ + + size_t max_decrement; + /**< Maximum number of bytes by which the maximum cache size can be + * decreased in any single step -- if applicable.*/ int epochs_before_eviction; + /**< In the ageout based cache size reduction algorithms, this field + * contains the minimum number of epochs an entry must remain unaccessed in + * cache before the cache size reduction algorithm tries to evict it. 3 is a + * reasonable value. */ hbool_t apply_empty_reserve; - double empty_reserve; + /**< Boolean flag indicating whether the ageout based decrement + * algorithms will maintain a empty reserve when decreasing cache size. */ + + double empty_reserve; + /**< Empty reserve as a fraction maximum cache size if applicable.\n When + * so directed, the ageout based algorithms will not decrease the maximum + * cache size unless the empty reserve can be met.\n The parameter must lie + * in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to start. */ + //! <!-- [H5AC_cache_config_t_decr_snip] --> /* parallel configuration fields: */ + //! <!-- [H5AC_cache_config_t_parallel_snip] --> size_t dirty_bytes_threshold; - int metadata_write_strategy; - + /**< Threshold number of bytes of dirty metadata generation for + * triggering synchronizations of the metadata caches serving the target + * file in the parallel case.\n Synchronization occurs whenever the number + * of bytes of dirty metadata created since the last synchronization exceeds + * this limit.\n This field only applies to the parallel case. While it is + * ignored elsewhere, it can still draw a value out of bounds error.\n It + * must be consistant across all caches on any given file.\n By default, + * this field is set to 256 KB. It shouldn't be more than half the current + * max cache size times the min clean fraction. */ + + int metadata_write_strategy; + /**< Desired metadata write strategy. The valid values for this field + * are:\n #H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: Specifies tha only + * process zero is allowed to write dirty metadata to disk.\n + * #H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: Specifies that process zero + * still makes the decisions as to what entries should be flushed, but the + * actual flushes are distributed across the processes in the computation to + * the extent possible.\n The src/H5ACpublic.h include file in the HDF5 + * library has detailed information on each strategy. */ + //! <!-- [H5AC_cache_config_t_parallel_snip] --> } H5AC_cache_config_t; - -/**************************************************************************** - * - * structure H5AC_cache_image_config_t - * - * H5AC_cache_image_ctl_t is a public structure intended for use in public - * APIs. At least in its initial incarnation, it is a copy of struct - * H5C_cache_image_ctl_t. - * - * The fields of the structure are discussed individually below: - * - * version: Integer field containing the version number of this version - * of the H5C_image_ctl_t structure. Any instance of - * H5C_image_ctl_t passed to the cache must have a known - * version number, or an error will be flagged. - * - * generate_image: Boolean flag indicating whether a cache image should - * be created on file close. - * - * save_resize_status: Boolean flag indicating whether the cache image - * should include the adaptive cache resize configuration and status. - * Note that this field is ignored at present. - * - * entry_ageout: Integer field indicating the maximum number of - * times a prefetched entry can appear in subsequent cache images. - * This field exists to allow the user to avoid the buildup of - * infrequently used entries in long sequences of cache images. - * - * The value of this field must lie in the range - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100). - * - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit - * is imposed on number of times a prefeteched entry can appear - * in subsequent cache images. - * - * A value of 0 prevents prefetched entries from being included - * in cache images. - * - * Positive integers restrict prefetched entries to the specified - * number of appearances. - * - * Note that the number of subsequent cache images that a prefetched - * entry has appeared in is tracked in an 8 bit field. Thus, while - * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its - * current value, any value in excess of 255 will be the functional - * equivalent of H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. - * - ****************************************************************************/ +//! <!-- [H5AC_cache_config_t_snip] --> #define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1 #define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1 #define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100 +//! <!-- [H5AC_cache_image_config_t_snip] --> +/** + * H5AC_cache_image_config_t is a public structure intended for use in public + * APIs. At least in its initial incarnation, it is a copy of \c struct \c + * H5C_cache_image_ctl_t. + */ + typedef struct H5AC_cache_image_config_t { - int version; + int version; + /**< Integer field containing the version number of this version of the \c + * H5C_image_ctl_t structure. Any instance of \c H5C_image_ctl_t passed + * to the cache must have a known version number, or an error will be + * flagged. + */ hbool_t generate_image; + /**< Boolean flag indicating whether a cache image should be created on file + * close. + */ hbool_t save_resize_status; - int entry_ageout; + /**< Boolean flag indicating whether the cache image should include the + * adaptive cache resize configuration and status. Note that this field + * is ignored at present. + */ + int entry_ageout; + /**< Integer field indicating the maximum number of times a + * prefetched entry can appear in subsequent cache images. This field + * exists to allow the user to avoid the buildup of infrequently used + * entries in long sequences of cache images. + * + * The value of this field must lie in the range \ref + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to \ref + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100). + * + * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit is + * imposed on number of times a prefeteched entry can appear in subsequent + * cache images. + * + * A value of 0 prevents prefetched entries from being included in cache + * images. + * + * Positive integers restrict prefetched entries to the specified number + * of appearances. + * + * Note that the number of subsequent cache images that a prefetched entry + * has appeared in is tracked in an 8 bit field. Thus, while \ref + * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its current + * value, any value in excess of 255 will be the functional equivalent of + * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. + */ } H5AC_cache_image_config_t; +//! <!-- [H5AC_cache_image_config_t_snip] --> + #ifdef __cplusplus } #endif diff --git a/src/H5Amodule.h b/src/H5Amodule.h index 45172bf..c89c93f 100644 --- a/src/H5Amodule.h +++ b/src/H5Amodule.h @@ -30,19 +30,39 @@ #define H5_MY_PKG_INIT YES /**\defgroup H5A H5A - * \brief Attribute Interface * - * \details The Attribute Interface, H5A, provides a mechanism for attaching - * additional information to a dataset, group, or named datatype. + * Use the functions in this module to manage HDF5 attributes. * - * Attributes are accessed by opening the object that they are - * attached to and are not independent objects. Typically an - * attribute is small in size and contains user metadata about the - * object that it is attached to. + * The Attribute Interface, H5A, provides a mechanism for attaching additional + * information to a dataset, group, or named datatype. * - * Attributes look similar to HDF5 datasets in that they have a - * datatype and dataspace. However, they do not support partial - * I/O operations and cannot be compressed or extended. + * Attributes are accessed by opening the object that they are attached to and + * are not independent objects. Typically an attribute is small in size and + * contains user metadata about the object that it is attached to. + * + * Attributes look similar to HDF5 datasets in that they have a datatype and + * dataspace. However, they do not support partial I/O operations and cannot be + * compressed or extended. + * + * <table> + * <tr><th>Create</th><th>Read</th></tr> + * <tr valign="top"> + * <td> + * \snippet H5A_examples.c create + * </td> + * <td> + * \snippet H5A_examples.c read + * </td> + * <tr><th>Update</th><th>Delete</th></tr> + * <tr valign="top"> + * <td> + * \snippet H5A_examples.c update + * </td> + * <td> + * \snippet H5A_examples.c delete + * </td> + * </tr> + * </table> * */ diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 9fdfdd4..0198668 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -22,17 +22,40 @@ #include "H5Opublic.h" /* Object Headers */ #include "H5Tpublic.h" /* Datatypes */ -/* Information struct for attribute (for H5Aget_info/H5Aget_info_by_idx) */ +//! <!-- [H5A_info_t_snip] --> +/** + * Information struct for H5Aget_info() / H5Aget_info_by_idx() + */ typedef struct { - hbool_t corder_valid; /* Indicate if creation order is valid */ - H5O_msg_crt_idx_t corder; /* Creation order */ - H5T_cset_t cset; /* Character set of attribute name */ - hsize_t data_size; /* Size of raw data */ + hbool_t corder_valid; /**< Indicate if creation order is valid */ + H5O_msg_crt_idx_t corder; /**< Creation order */ + H5T_cset_t cset; /**< Character set of attribute name */ + hsize_t data_size; /**< Size of raw data */ } H5A_info_t; +//! <!-- [H5A_info_t_snip] --> -/* Typedef for H5Aiterate2() callbacks */ +//! <!-- [H5A_operator2_t_snip] --> +/** + * Typedef for H5Aiterate2() / H5Aiterate_by_name() callbacks + * \param[in] location_id The identifier for the group, dataset + * or named datatype being iterated over + * \param[in] attr_name The name of the current object attribute + * \param[in] ainfo The attribute’s info struct + * \param[in,out] op_data A pointer to the operator data passed in to + * H5Aiterate2() or H5Aiterate_by_name() + * \returns The return values from an operator are: + * \li Zero causes the iterator to continue, returning zero when + * all attributes have been processed. + * \li Positive causes the iterator to immediately return that + * positive value, indicating short-circuit success. The + * iterator can be restarted at the next attribute. + * \li Negative causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the next + * attribute. + */ typedef herr_t (*H5A_operator2_t)(hid_t location_id /*in*/, const char *attr_name /*in*/, const H5A_info_t *ainfo /*in*/, void *op_data /*in,out*/); +//! <!-- [H5A_operator2_t_snip] --> /********************/ /* Public Variables */ @@ -103,8 +126,8 @@ H5_DLL herr_t H5Aclose(hid_t attr_id); * The attribute identifier returned by this function must be released * with H5Aclose() resource leaks will develop. * - * \note The \p acpl and \p aapl parameters are currently not used; specify - * #H5P_DEFAULT. + * \note The \p aapl parameter is currently not used; specify #H5P_DEFAULT. + * * \note If \p loc_id is a file identifier, the attribute will be attached * that file’s root group. * @@ -164,6 +187,599 @@ H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_ */ H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Deletes an attribute from a specified location + * + * \fgdt_loc_id + * \param[in] attr_name Name of the attribute to delete + * + * \return \herr_t + * + * \details H5Adelete() removes the attribute specified by its name, + * \p attr_name, from a file, dataset, group, or named datatype. + * This function should not be used when attribute identifiers + * are open on \p loc_id as it may cause the internal indexes of + * the attributes to change and future writes to the open + * attributes to produce incorrect results. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Adelete(hid_t loc_id, const char *attr_name); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Deletes an attribute from an object according to index order + * + * \fgdt_loc_id + * \param[in] obj_name Name of object, relative to location, from which + * attribute is to be removed + * \param[in] idx_type Type of index + * \param[in] order Order in which to iterate over index + * \param[in] n Offset within index + * \lapl_id + * + * \return \herr_t + * + * \details H5Adelete_by_idx() removes an attribute, specified by its + * location in an index, from an object. + * + * The object from which the attribute is to be removed is + * specified by a location identifier and name, \p loc_id and + * \p obj_name, respectively. If \p loc_id fully specifies the + * object from which the attribute is to be removed, \p obj_name + * should be '.' (a dot). + * + * The attribute to be removed is specified by a position in an + * index, \p n. The type of index is specified by \p idx_type and + * may be #H5_INDEX_NAME, for an alpha-numeric index by name, or + * #H5_INDEX_CRT_ORDER, for an index by creation order. The order + * in which the index is to be traversed is specified by \p order + * and may be #H5_ITER_INC (increment) for top-down iteration, + * #H5_ITER_DEC (decrement) for bottom-up iteration, or + * #H5_ITER_NATIVE, in which case HDF5 will iterate in the + * fastest-available order. For example, if \p idx_type, \p order, + * and \p n are set to #H5_INDEX_NAME, #H5_ITER_INC, and 5, + * respectively, the fifth attribute by alpha-numeric order of + * attribute names will be removed. + * + * For a discussion of \p idx_type and \p order, the valid values + * of those parameters, and the use of \p n, see the description + * of H5Aiterate2(). + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to access + * the object, \p obj_name. + + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Removes an attribute from a specified location + * + * \fgdt_loc_id + * \param[in] obj_name Name of object, relative to location, from which + * attribute is to be removed + * \param[in] attr_name Name of attribute to delete + * \lapl_id + * + * \return \herr_t + * + * \details H5Adelete_by_name() removes the attribute \p attr_name + * from an object specified by location and name, \p loc_id and + * \p obj_name, respectively. + * + * If \p loc_id fully specifies the object from which the + * attribute is to be removed, \p obj_name should be '.' (a dot). + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to + * access the object, \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Determines whether an attribute with a given name exists on an + * object + * + * \fgdt_loc_id{obj_id} + * \param[in] attr_name Attribute name + * + * \return \htri_t + * + * \details H5Aexists() determines whether the attribute \p attr_name + * exists on the object specified by \p obj_id. + * + * \since 1.8.0 + * + */ +H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Determines whether an attribute with a given name exists on an + * object + * + * \fgdt_loc_id{obj_id} + * \param[in] obj_name Object name + * \param[in] attr_name Attribute name + * \lapl_id + * + * \return \htri_t + * + * \details H5Aexists_by_name() determines whether the attribute + * \p attr_name exists on an object. That object is specified by + * its location and name, \p loc_id and \p obj_name, respectively. + * + * \p loc_id specifies a location in the file containing the object. + * \p obj_name is the name of the object to which the attribute is + * attached and can be a relative name, relative to \p loc_id, + * or an absolute name, based in the root group of the file. If + * \p loc_id fully specifies the object, \p obj_name should be '.' + * (a dot). + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to access + * \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Gets an attribute creation property list identifier + * + * \attr_id + * + * \return \hid_tv{attribute's creation property list} + * + * \details H5Aget_create_plist() returns an identifier for the attribute + * creation property list associated with the attribute specified + * by \p attr_id. + * + * The creation property list identifier should be released with + * H5Pclose(). + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Aget_create_plist(hid_t attr_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Retrieves attribute information, by attribute identifier + * + * \attr_id + * \param[out] ainfo Attribute information struct + * + * \return \herr_t + * + * \details H5Aget_info() retrieves attribute information, locating the + * attribute with an attribute identifier, \p attr_id, which is + * the identifier returned by H5Aopen() or H5Aopen_by_idx(). The + * attribute information is returned in the \p ainfo struct. + * + * The \p ainfo struct is defined as follows: + * \snippet this H5A_info_t_snip + * + * \p corder_valid indicates whether the creation order data is + * valid for this attribute. Note that if creation order is not + * being tracked, no creation order data will be valid. Valid + * values are \c TRUE and \c FALSE. + * + * \p corder is a positive integer containing the creation + * order of the attribute. This value is 0-based, so, for + * example, the third attribute created will have a \p corder + * value of 2. + * + * \p cset indicates the character set used for the attribute’s + * name; valid values are defined in H5Tpublic.h and include + * the following: + * \csets + * This value is set with H5Pset_char_encoding(). + * + * \p data_size indicates the size, in the number of characters, + * of the attribute. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Retrieves attribute information by attribute index position + * + * \fgdt_loc_id + * \param[in] obj_name Name of object to which attribute is attached, + * relative to location + * \param[in] idx_type Type of index + * \param[in] order Index traversal order + * \param[in] n Attribute’s position in index + * \param[out] ainfo Struct containing returned attribute information + * \lapl_id + * + * \return \herr_t + * + * \details H5Aget_info_by_idx() retrieves information for an attribute + * that is attached to an object, which is specified by its + * location and name, \p loc_id and \p obj_name, respectively. + * The attribute is located by its index position and the attribute + * information is returned in the \p ainfo struct. + * + * If \p loc_id fully specifies the object to which the attribute + * is attached, \p obj_name should be '.' (a dot). + * + * The attribute is located by means of an index type, an index + * traversal order, and a position in the index, \p idx_type, + * \p order and \p n, respectively. These parameters and their + * valid values are discussed in the description of H5Aiterate2(). + * + * The \p ainfo struct, which will contain the returned attribute + * information, is described in H5Aget_info(). + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to access + * the object, \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo /*out*/, hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Retrieves attribute information, by attribute name + * + * \fgdt_loc_id + * + * \param[in] obj_name Name of object to which attribute is attached, + * relative to location + * \param[in] attr_name Attribute name + * \param[out] ainfo Struct containing returned attribute information + * \lapl_id + * + * \return \herr_t + * + * \details H5Aget_info_by_name() retrieves information for an attribute, + * \p attr_name, that is attached to an object specified by its + * location and name, \p loc_id and \p obj_name, respectively. + * The attribute information is returned in the \p ainfo struct. + * + * If \p loc_id fully specifies the object to which the attribute + * is attached, \p obj_name should be '.' (a dot). + * + * The \p ainfo struct is described in H5Aget_info(). + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to + * access the object, \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, + H5A_info_t *ainfo /*out*/, hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Gets an attribute name + * + * \attr_id + * \param[in] buf_size The size of the buffer to store the name in + * \param[out] buf Buffer to store name in + * + * \return Returns the length of the attribute's name, which may be longer + * than \p buf_size, if successful. Otherwise returns a negative + * value. + * + * \details H5Aget_name() retrieves the name of an attribute specified by + * the identifier, \p attr_id. Up to \p buf_size characters are + * stored in \p buf followed by a \0 string terminator. If the + * name of the attribute is longer than (\p buf_size -1), the + * string terminator is stored in the last position of the buffer + * to properly terminate the string. + * + * If the user only wants to find out the size of this name, the + * values 0 and NULL can be passed in for the parameters + * \p bufsize and \p buf. + * + * \since 1.0.0 + * + */ +H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Gets an attribute name, by attribute index position + * + * \fgdt_loc_id + * \param[in] obj_name Name of object to which attribute is attached, + * relative to location + * \param[in] idx_type Type of index + * \param[in] order Index traversal order + * \param[in] n Attribute’s position in index + * \param[out] name Attribute name + * \param[in] size Size, in bytes, of attribute name + * \lapl_id + * + * \return Returns attribute name size, in bytes, if successful; + * otherwise returns a negative value. + * + * \details H5Aget_name_by_idx() retrieves the name of an attribute that is + * attached to an object, which is specified by its location and + * name, \p loc_id and \p obj_name, respectively. The attribute is + * located by its index position, the size of the name is specified + * in \p size, and the attribute name is returned in \p name. + * + * If \p loc_id fully specifies the object to which the attribute + * is attached, \p obj_name should be '.' (a dot). + * + * The attribute is located by means of an index type, an index + * traversal order, and a position in the index, \p idx_type, + * \p order and \p n, respectively. These parameters and their + * valid values are discussed in the description of H5Aiterate2(). + * + * If the attribute name’s size is unknown, the values 0 and NULL + * can be passed in for the parameters \p size and \p name. The + * function’s return value will provide the correct value for + * \p size. + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to access + * the object, \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, + hid_t lapl_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Gets a copy of the dataspace for an attribute + * + * \attr_id + * + * \return \hid_tv{attribute dataspace} + * + * \details H5Aget_space() retrieves a copy of the dataspace for an + * attribute. The dataspace identifier returned from this + * function must be released with H5Sclose() or resource leaks + * will develop. + * + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Aget_space(hid_t attr_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Returns the amount of storage required for an attribute + * + * \attr_id + * + * \return Returns the amount of storage size allocated for the attribute; + * otherwise returns 0 (zero). + * + * \details H5Aget_storage_size() returns the amount of storage that is + * required for the specified attribute, \p attr_id. + * + * \since 1.6.0 + * + */ +H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Gets an attribute datatype + * + * \attr_id + * + * \return \hid_t{datatype} + * + * \details H5Aget_type() retrieves a copy of the datatype for an attribute. + * The datatype is reopened if it is a named type before returning + * it to the application. The datatypes returned by this function + * are always read-only. If an error occurs when atomizing the + * return datatype, then the datatype is closed. + * + * The datatype identifier returned from this function must be + * released with H5Tclose() or resource leaks will develop. + * + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Aget_type(hid_t attr_id); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Calls user-defined function for each attribute on an object + * + * \fgdt_loc_id + * \param[in] idx_type Type of index + * \param[in] order Order in which to iterate over index + * \param[in,out] idx Initial and returned offset within index + * \param[in] op User-defined function to pass each attribute to + * \param[in,out] op_data User data to pass through to and to be returned + * by iterator operator function + * + * \return \herr_t + * Further note that this function returns the return value of the + * last operator if it was non-zero, which can be a negative value, + * zero if all attributes were processed, or a positive value + * indicating short-circuit success. + * + * \details H5Aiterate2() iterates over the attributes attached to a + * dataset, named datatype, or group, as specified by \p loc_id. + * For each attribute, user-provided data, \p op_data, with + * additional information as defined below, is passed to a + * user-defined function, \p op, which operates on that + * attribute. + * + * The order of the iteration and the attributes iterated over + * are specified by three parameters: the index type, + * \p idx_type; the order in which the index is to be traversed, + * \p order; and the attribute’s position in the index, \p idx. + * + * The type of index specified by \p idx_type can be one of the + * following: + * + * \indexes + * + * The order in which the index is to be traversed, as specified + * by \p order, can be one of the following: + * + * \orders + * + * The next attribute to be operated on is specified by \p idx, + * a position in the index. + * + * For example, if \p idx_type, \p order, and \p idx are set to + * #H5_INDEX_NAME, #H5_ITER_INC, and 5, respectively, the attribute + * in question is the fifth attribute from the beginning of the + * alpha-numeric index of attribute names. If \p order were set to + * #H5_ITER_DEC, it would be the fifth attribute from the end of + * the index. + * + * The parameter \p idx is passed in on an H5Aiterate2() call with + * one value and may be returned with another value. The value + * passed in identifies the parameter to be operated on first; + * the value returned identifies the parameter to be operated on + * in the next step of the iteration. + * + * \p op is a user-defined function whose prototype is defined + * as follows: + * \snippet this H5A_operator2_t_snip + * \click4more + * + * \note This function is also available through the H5Aiterate() macro. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, + H5A_operator2_t op, void *op_data); +/*--------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Calls user-defined function for each attribute on an object + * + * \fgdt_loc_id + * \param[in] obj_name Name of object, relative to location + * \param[in] idx_type Type of index + * \param[in] order Order in which to iterate over index + * \param[in,out] idx Initial and returned offset within index + * \param[in] op User-defined function to pass each attribute to + * \param[in,out] op_data User data to pass through to and to be returned + * by iterator operator function + * \lapl_id + * + * \return \herr_t + * Further note that this function returns the return value of + * the last operator if it was non-zero, which can be a negative + * value, zero if all attributes were processed, or a positive value + * indicating short-circuit success. + * + * \details H5Aiterate_by_name() iterates over the attributes attached + * to the dataset or group specified with \p loc_id and \p obj_name. + * For each attribute, user-provided data, \p op_data, with + * additional information as defined below, is passed to a + * user-defined function, \p op, which operates on that attribute. + * + * If \p loc_id fully specifies the object to which these + * attributes are attached, \p obj_name should be '.' (a dot). + * + * The order of the iteration and the attributes iterated over + * are specified by three parameters: the index type, \p idx_type; + * the order in which the index is to be traversed, \p order; + * and the attribute’s position in the index, \p idx. + * + * The type of index specified by \p idx_type can be one of the + * following: + * + * \indexes + * + * The order in which the index is to be traversed, as specified + * by \p order, can be one of the following: + * + * \orders + * + * The next attribute to be operated on is specified by \p idx, + * a position in the index. + * + * For example, if \p idx_type, \p order, and \p idx are set to + * #H5_INDEX_NAME, #H5_ITER_INC, and 5, respectively, the attribute + * in question is the fifth attribute from the beginning of the + * alpha-numeric index of attribute names. If \p order were set to + * #H5_ITER_DEC, it would be the fifth attribute from the end of + * the index. + * + * The parameter \p idx is passed in on an H5Aiterate_by_name() + * call with one value and may be returned with another value. The + * value passed in identifies the parameter to be operated on first; + * the value returned identifies the parameter to be operated on in + * the next step of the iteration. + * + * \p op is a user-defined function whose prototype is defined + * as follows: + * \snippet this H5A_operator2_t_snip + * \click4more + * + * Valid return values from an operator and the resulting + * H5Aiterate_by_name() and \p op behavior are as follows: + * + * \li Zero causes the iterator to continue, returning zero when + * all attributes have been processed. + * \li A positive value causes the iterator to immediately return + * that positive value, indicating short-circuit success. + * The iterator can be restarted at the next attribute, as + * indicated by the return value of \p idx. + * \li A negative value causes the iterator to immediately return + * that value, indicating failure. The iterator can be + * restarted at the next attribute, as indicated by the return + * value of \p idx. + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to access + * the object, \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, + hid_t lapl_id); /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -313,6 +929,28 @@ H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *att * */ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Renames an attribute + * + * \fgdt_loc_id + * \param[in] old_name Name of the attribute to be changed + * \param[in] new_name New name for the attribute + * + * \return \herr_t + * + * \details H5Arename() changes the name of the attribute located at + * \p loc_id. + * + * The old name, \p old_name, is changed to the new name, + * \p new_name. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name); /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -344,34 +982,32 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf); * \see H5Aread() * */ -H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); -H5_DLL hid_t H5Aget_space(hid_t attr_id); -H5_DLL hid_t H5Aget_type(hid_t attr_id); -H5_DLL hid_t H5Aget_create_plist(hid_t attr_id); -H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); -H5_DLL ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, - hid_t lapl_id); -H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id); -H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/); -H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - H5A_info_t *ainfo /*out*/, hid_t lapl_id); -H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5A_info_t *ainfo /*out*/, hid_t lapl_id); -H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name); -H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, - const char *new_attr_name, hid_t lapl_id); -H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5A_operator2_t op, void *op_data); -H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, - hid_t lapd_id); -H5_DLL herr_t H5Adelete(hid_t loc_id, const char *name); -H5_DLL herr_t H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id); -H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, - hsize_t n, hid_t lapl_id); -H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name); -H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char *attr_name, hid_t lapl_id); +H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); +/*-------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \fgdt_loc_id + * \param[in] obj_name Name of object, relative to location, whose + * attribute is to be renamed + * \param[in] old_attr_name Prior attribute name + * \param[in] new_attr_name New attribute name + * \lapl_id + * + * \details H5Arename_by_name() changes the name of attribute that is + * attached to the object specified by \p loc_id and \p obj_name. + * The attribute named \p old_attr_name is renamed + * \p new_attr_name. + * + * The link access property list, \p lapl_id, may provide + * information regarding the properties of links required to + * access the object, \p obj_name. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, + const char *new_attr_name, hid_t lapl_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -383,9 +1019,28 @@ H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char * /* Typedefs */ -/* Typedef for H5Aiterate1() callbacks */ +//! <!-- [H5A_operator1_t_snip] --> +/** + * \brief Typedef for H5Aiterate1() callbacks + * + * \param[in] location_id The identifier for the group, dataset + * or named datatype being iterated over + * \param[in] attr_name The name of the current object attribute + * \param[in,out] operator_data A pointer to the operator data passed in to + * H5Aiterate1() + * \returns The return values from an operator are: + * \li Zero causes the iterator to continue, returning zero when + * all attributes have been processed. + * \li Positive causes the iterator to immediately return that + * positive value, indicating short-circuit success. The + * iterator can be restarted at the next attribute. + * \li Negative causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the next + * attribute. + */ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_name /*in*/, void *operator_data /*in,out*/); +//! <!-- [H5A_operator1_t_snip] --> /* Function prototypes */ /* --------------------------------------------------------------------------*/ @@ -433,11 +1088,117 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_nam * \see H5Aclose() * */ -H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id); -H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name); -H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx); -H5_DLL int H5Aget_num_attrs(hid_t loc_id); -H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data); +H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id); +/* --------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Determines the number of attributes attached to an object + * + * \fgdt_loc_id + * + * \return Returns the number of attributes if successful; otherwise returns + * a negative value. + * + * \deprecated This function is deprecated in favor of the functions + * H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx(). + * + * \details H5Aget_num_attrs() returns the number of attributes attached to + * the object specified by its identifier, \p loc_id. + * + * \since 1.0.0 + * + */ +H5_DLL int H5Aget_num_attrs(hid_t loc_id); +/* --------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Calls a user’s function for each attribute on an object + * + * \loc_id + * \param[in,out] idx Starting (in) and ending (out) attribute index + * \param[in] op User's function to pass each attribute to + * \param[in,out] op_data User's data to pass through to iterator operator + * function + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function + * H5Aiterate2(). + * + * \details H5Aiterate1() iterates over the attributes of the object + * specified by its identifier, \p loc_id. The object can be a + * group, dataset, or named datatype. For each attribute of the + * object, the \p op_data and some additional information specified + * below are passed to the operator function \p op. The iteration + * begins with the attribute specified by its index, \p idx; the + * index for the next attribute to be processed by the operator, + * \p op, is returned in \p idx. If \p idx is the null pointer, + * then all attributes are processed. + * + * \p op is a user-defined function whose prototype is defined as follows: + * \snippet this H5A_operator1_t_snip + * \click4more + * + * \version 1.8.0 The function \p H5Aiterate was renamed to H5Aiterate1() + * and deprecated in this release. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *idx, H5A_operator1_t op, void *op_data); +/* --------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Opens the attribute specified by its index + * + * \loc_id + * \param[in] idx Index of the attribute to open + * + * \return \hid_tv{attribute} + * + * \deprecated This function is deprecated in favor of the function + * H5Aopen_by_idx(). + * + * \details H5Aopen_idx() opens an attribute which is attached to the + * object specified with \p loc_id . The location object may be + * either a group, dataset, or named datatype, all of which may + * have any sort of attribute. The attribute specified by the index, + * \p idx , indicates the attribute to access. The value of \p idx + * is a 0-based, non-negative integer. The attribute identifier + * returned from this function must be released with H5Aclose() + * or resource leaks will develop. + * + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx); +/* --------------------------------------------------------------------------*/ +/** + * \ingroup H5A + * + * \brief Opens an attribute specified by name + * + * \loc_id + * \param[in] name Attribute name + * + * \return \hid_tv{attribute} + * + * \deprecated This function is deprecated in favor of the function + * H5Aopen_by_name(). + * + * \details H5Aopen_name() opens an attribute specified by its name, + * \p name, which is attached to the object specified with + * \p loc_id. The location object may be either a group, dataset, + * or named datatype, which may have any sort of attribute. The + * attribute identifier returned from this function must be + * released with H5Aclose() or resource leaks will develop. + * + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Cpublic.h b/src/H5Cpublic.h index 0e6fb84..79ece10 100644 --- a/src/H5Cpublic.h +++ b/src/H5Cpublic.h @@ -31,15 +31,34 @@ extern "C" { #endif -enum H5C_cache_incr_mode { H5C_incr__off, H5C_incr__threshold }; +enum H5C_cache_incr_mode { + H5C_incr__off, + /**<Automatic cache size increase is disabled, and the remaining increment fields are ignored.*/ -enum H5C_cache_flash_incr_mode { H5C_flash_incr__off, H5C_flash_incr__add_space }; + H5C_incr__threshold + /**<Automatic cache size increase is enabled using the hit rate threshold algorithm.*/ +}; + +enum H5C_cache_flash_incr_mode { + H5C_flash_incr__off, + /**<Flash cache size increase is disabled.*/ + + H5C_flash_incr__add_space + /**<Flash cache size increase is enabled using the add space algorithm.*/ +}; enum H5C_cache_decr_mode { H5C_decr__off, + /**<Automatic cache size decrease is disabled.*/ + H5C_decr__threshold, + /**<Automatic cache size decrease is enabled using the hit rate threshold algorithm.*/ + H5C_decr__age_out, + /**<Automatic cache size decrease is enabled using the ageout algorithm. */ + H5C_decr__age_out_with_threshold + /**<Automatic cache size decrease is enabled using the ageout with hit rate threshold algorithm.*/ }; #ifdef __cplusplus diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h index 1f4d7c1..595c714 100644 --- a/src/H5Dmodule.h +++ b/src/H5Dmodule.h @@ -29,4 +29,37 @@ #define H5_MY_PKG_ERR H5E_DATASET #define H5_MY_PKG_INIT YES +/**\defgroup H5D H5D + * + * Use the functions in this module to manage HDF5 datasets, including the + * transfer of data between memory and disk and the description of dataset + * properties. Datasets are used by other HDF5 APIs and referenced either by + * name or by a handle. Such handles can be obtained by either creating or + * opening the dataset. + * + * Typical stages in the HDF5 dataset life cycle are shown below in introductory + * examples. + * + * <table> + * <tr><th>Create</th><th>Read</th></tr> + * <tr valign="top"> + * <td> + * \snippet H5D_examples.c create + * </td> + * <td> + * \snippet H5D_examples.c read + * </td> + * <tr><th>Update</th><th>Delete</th></tr> + * <tr valign="top"> + * <td> + * \snippet H5D_examples.c update + * </td> + * <td> + * \snippet H5D_examples.c delete + * </td> + * </tr> + * </table> + * + */ + #endif /* H5Dmodule_H */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index c1ca698..b73e62d 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -39,30 +39,41 @@ /* Public Typedefs */ /*******************/ -/* Values for the H5D_LAYOUT property */ +//! <!-- [H5D_layout_t_snip] --> +/** + * Values for the H5D_LAYOUT property + */ typedef enum H5D_layout_t { H5D_LAYOUT_ERROR = -1, - H5D_COMPACT = 0, /*raw data is very small */ - H5D_CONTIGUOUS = 1, /*the default */ - H5D_CHUNKED = 2, /*slow and fancy */ - H5D_VIRTUAL = 3, /*actual data is stored in other datasets */ - H5D_NLAYOUTS = 4 /*this one must be last! */ + H5D_COMPACT = 0, /**< raw data is very small */ + H5D_CONTIGUOUS = 1, /**< the default */ + H5D_CHUNKED = 2, /**< slow and fancy */ + H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */ + H5D_NLAYOUTS = 4 /**< this one must be last! */ } H5D_layout_t; +//! <!-- [H5D_layout_t_snip] --> -/* Types of chunk index data structures */ +//! <!-- [H5D_chunk_index_t_snip] --> +/** + * Types of chunk index data structures + */ typedef enum H5D_chunk_index_t { - H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */ + H5D_CHUNK_IDX_BTREE = 0, /**< v1 B-tree index (default) */ H5D_CHUNK_IDX_SINGLE = - 1, /* Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */ - H5D_CHUNK_IDX_NONE = 2, /* Implicit: No Index (H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */ - H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */ - H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */ - H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */ - H5D_CHUNK_IDX_NTYPES /* This one must be last! */ + 1, /**< Single Chunk index (cur dims[]=max dims[]=chunk dims[]; filtered & non-filtered) */ + H5D_CHUNK_IDX_NONE = 2, /**< Implicit: No Index (#H5D_ALLOC_TIME_EARLY, non-filtered, fixed dims) */ + H5D_CHUNK_IDX_FARRAY = 3, /**< Fixed array (for 0 unlimited dims) */ + H5D_CHUNK_IDX_EARRAY = 4, /**< Extensible array (for 1 unlimited dim) */ + H5D_CHUNK_IDX_BT2 = 5, /**< v2 B-tree index (for >1 unlimited dims) */ + H5D_CHUNK_IDX_NTYPES /**< This one must be last! */ } H5D_chunk_index_t; +//! <!-- [H5D_chunk_index_t_snip] --> -/* Values for the space allocation time property */ +//! <!-- [H5D_alloc_time_t_snip] --> +/** + * Values for the space allocation time property + */ typedef enum H5D_alloc_time_t { H5D_ALLOC_TIME_ERROR = -1, H5D_ALLOC_TIME_DEFAULT = 0, @@ -70,51 +81,84 @@ typedef enum H5D_alloc_time_t { H5D_ALLOC_TIME_LATE = 2, H5D_ALLOC_TIME_INCR = 3 } H5D_alloc_time_t; +//! <!-- [H5D_alloc_time_t_snip] --> -/* Values for the status of space allocation */ +//! <!-- [H5D_space_status_t_snip] --> +/** + * Values for the status of space allocation + */ typedef enum H5D_space_status_t { H5D_SPACE_STATUS_ERROR = -1, H5D_SPACE_STATUS_NOT_ALLOCATED = 0, H5D_SPACE_STATUS_PART_ALLOCATED = 1, H5D_SPACE_STATUS_ALLOCATED = 2 } H5D_space_status_t; +//! <!-- [H5D_space_status_t_snip] --> -/* Values for time of writing fill value property */ +//! <!-- [H5D_fill_time_t_snip] --> +/** + * Values for time of writing fill value property + */ typedef enum H5D_fill_time_t { H5D_FILL_TIME_ERROR = -1, H5D_FILL_TIME_ALLOC = 0, H5D_FILL_TIME_NEVER = 1, H5D_FILL_TIME_IFSET = 2 } H5D_fill_time_t; +//! <!-- [H5D_fill_time_t_snip] --> -/* Values for fill value status */ +//! <!-- [H5D_fill_value_t_snip] --> +/** + * Values for fill value status + */ typedef enum H5D_fill_value_t { H5D_FILL_VALUE_ERROR = -1, H5D_FILL_VALUE_UNDEFINED = 0, H5D_FILL_VALUE_DEFAULT = 1, H5D_FILL_VALUE_USER_DEFINED = 2 } H5D_fill_value_t; +//! <!-- [H5D_fill_value_t_snip] --> -/* Values for VDS bounds option */ +//! <!-- [H5D_vds_view_t_snip] --> +/** + * Values for VDS bounds option + */ typedef enum H5D_vds_view_t { H5D_VDS_ERROR = -1, H5D_VDS_FIRST_MISSING = 0, H5D_VDS_LAST_AVAILABLE = 1 } H5D_vds_view_t; +//! <!-- [H5D_vds_view_t_snip] --> -/* Callback for H5Pset_append_flush() in a dataset access property list */ +//! <!-- [H5D_append_cb_t_snip] --> +/** + * Callback for H5Pset_append_flush() in a dataset access property list + */ typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data); +//! <!-- [H5D_append_cb_t_snip] --> -/* Define the operator function pointer for H5Diterate() */ +//! <!-- [H5D_operator_t_snip] --> +/** + * Define the operator function pointer for H5Diterate() + */ typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); +//! <!-- [H5D_operator_t_snip] --> -/* Define the operator function pointer for H5Dscatter() */ +//! <!-- [H5D_scatter_func_t_snip] --> +/** + * Define the operator function pointer for H5Dscatter() + */ typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/, void *op_data); +//! <!-- [H5D_scatter_func_t_snip] --> -/* Define the operator function pointer for H5Dgather() */ +//! <!-- [H5D_gather_func_t_snip] --> +/** + * Define the operator function pointer for H5Dgather() + */ typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_used, void *op_data); +//! <!-- [H5D_gather_func_t_snip] --> /********************/ /* Public Variables */ @@ -127,42 +171,1266 @@ typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_us extern "C" { #endif -H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, - hid_t dcpl_id, hid_t dapl_id); -H5_DLL hid_t H5Dcreate_anon(hid_t file_id, hid_t type_id, hid_t space_id, hid_t plist_id, hid_t dapl_id); -H5_DLL hid_t H5Dopen2(hid_t file_id, const char *name, hid_t dapl_id); -H5_DLL hid_t H5Dget_space(hid_t dset_id); -H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation); -H5_DLL hid_t H5Dget_type(hid_t dset_id); -H5_DLL hid_t H5Dget_create_plist(hid_t dset_id); -H5_DLL hid_t H5Dget_access_plist(hid_t dset_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Creates a new dataset and links it into the file + * + * \fgdta_loc_id + * \param[in] name Name of the dataset to create + * \type_id + * \space_id + * \lcpl_id + * \dcpl_id + * \dapl_id + * + * \return \hid_t{dataset} + * + * \details H5Dcreate2() creates a new dataset named \p name at + * the location specified by \p loc_id, and associates constant + * and initial persistent properties with that dataset, including + * the datatype \p dtype_id, the dataspace \p space_id, and + * other properties as specified by the dataset creation property + * list \p dcpl_id and the access property list \p dapl_id, + * respectively. Once created, the dataset is opened for access. + * + * \p loc_id may specify a file, group, dataset, named datatype, + * or attribute. If an attribute, dataset, or named datatype is + * specified then the dataset will be created at the location + * where the attribute, dataset, or named datatype is attached. + * + * \p name may be either an absolute path in the file or a relative + * path from \p loc_id naming the dataset. + * + * \p dtype_id specifies the datatype of each data element as stored + * in the file. If \p dtype_id is either a fixed-length or + * variable-length string, it is important to set the string length + * when defining the datatype. String datatypes are derived from + * #H5T_C_S1 (or #H5T_FORTRAN_S1 for Fortran codes), which defaults + * to 1 character in size. + * + * If \p dtype_id is a committed datatype, and if the file location + * associated with the committed datatype is different from the + * file location where the dataset will be created, the datatype + * is copied and converted to a transient type. + * + * The link creation property list, \p lcpl_id, governs creation + * of the link(s) by which the new dataset is accessed and the + * creation of any * intermediate groups that may be missing. + * + * The datatype and dataspace properties and the dataset creation + * and access property lists are attached to the dataset, so the + * caller may derive new datatypes, dataspaces, and creation and + * access properties from the old ones and reuse them in calls to + * create additional datasets. Once created, the dataset can be + * read from or written to. Reading data from a datatset that was + * not previously written, the HDF5 library will return default + * or user-defined fill values. + * + * To conserve and release resources, the dataset should be closed + * when access is no longer required. + * + * \since 1.8.0 + * + * \see H5Dopen2(), H5Dclose(), H5Tset_size() + * + */ +H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, + hid_t dcpl_id, hid_t dapl_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Creates a dataset in a file without linking it into the file + * structure + * + * \fgdta_loc_id + * \type_id + * \space_id + * \dcpl_id + * \dapl_id + * + * \return \hid_t{dataset} + * + * \details H5Dcreate_anon() creates a dataset in the file specified + * by \p loc_id. + * + * \p loc_id may specify a file, group, dataset, named datatype, + * or attribute. If an attribute, dataset, or named datatype is + * specified then the dataset will be created at the location + * where the attribute, dataset, or named datatype is attached. + * + * The dataset’s datatype and dataspace are specified by + * \p type_id and \p space_id, respectively. These are the + * datatype and dataspace of the dataset as it will exist in + * the file, which may differ from the datatype and dataspace + * in application memory. + * + * Dataset creation property list and dataset access creation + * property list are specified by \p dcpl_id and \p dapl_id. + * + * H5Dcreate_anon() returns a new dataset identifier. Using + * this identifier, the new dataset must be linked into the + * HDF5 file structure with H5Olink() or it will be deleted + * from the file when the file is closed. + * + * See H5Dcreate2() for further details and considerations on + * the use of H5Dcreate2() and H5Dcreate_anon(). + * + * The differences between this function and H5Dcreate2() are + * as follows: + * \li H5Dcreate_anon() explicitly includes a dataset access property + * list. H5Dcreate() always uses default dataset access properties. + * + * \li H5Dcreate_anon() neither provides the new dataset’s name nor + * links it into the HDF5 file structure; those actions must be + * performed separately through a call to H5Olink(), which offers + * greater control over linking. + * + * A dataset created with this function should be closed with + * H5Dclose() when the dataset is no longer needed so that resource + * leaks will not develop. + * + * \since 1.8.0 + * + * \see H5Olink(), H5Dcreate(), Using Identifiers + * + */ +H5_DLL hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Creates a new dataset and links it into the file + * + * \fgdta_loc_id + * \param[in] name Name of the dataset to open + * \dapl_id + * + * \return \hid_t{dataset} + * + * \details H5Dopen2() opens the existing dataset specified + * by a location identifier and name, \p loc_id and \p name, + * respectively. + * + * \p loc_id may specify a file, group, dataset, named datatype, + * or attribute. If an attribute, dataset, or named datatype is + * specified then the dataset will be opened at the location + * where the attribute, dataset, or named datatype is attached. + * + * The dataset access property list, \p dapl_id, provides + * information regarding access to the dataset. + * + * To conserve and release resources, the dataset should be closed + * when access is no longer required. + * + * \since 1.8.0 + * + * \see H5Dcreate2(), H5Dclose() + * + */ +H5_DLL hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id); + +/** + * -------------------------------------------------------------------------- + *\ingroup H5D + * + * \brief Returns an identifier for a copy of the dataspace for a dataset + * + * \dset_id + * + * \return \hid_t{dataspace} + * + * \details H5Dget_space() makes a copy of the dataspace of + * the dataset specified by \p dset_id. The function returns an + * identifier for the new copy of the dataspace. + * + * A dataspace identifier returned from this function should + * be released with H5Sclose() when the identifier is no longer + * needed so that resource leaks will not occur. + * + * \see H5Sclose() + * + */ +H5_DLL hid_t H5Dget_space(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * \todo Document this function! + */ +H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Returns an identifier for a copy of the datatype for a dataset + * + * \dset_id + * + * \return \hid_t{datatype} + * + * \details H5Dget_type() returns an identifier of a copy of + * the datatype for a dataset. + * + * If a dataset has a named datatype, then an identifier to the + * opened datatype is returned. Otherwise, the returned datatype + * is read-only. If atomization of the datatype fails, then the + * datatype is closed. + * + * A datatype identifier returned from this function should be + * released with H5Tclose() when the identifier is no longer + * needed to prevent resource leaks. + * + * \note Datatype Identifiers + * + * Please note that the datatype identifier is actually an object + * identifier or a handle returned from opening the datatype. It + * is not persistent and its value can be different from one HDF5 + * session to the next. + * + * H5Tequal() can be used to compare datatypes. + * + * HDF5 High Level APIs that may also be of interest are: + * + * H5LTdtype_to_text() creates a text description of a + * datatype. H5LTtext_to_dtype() creates an HDF5 datatype + * given a text description. + * + */ +H5_DLL hid_t H5Dget_type(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Returns an identifier for a copy of the dataset creation + * property list for a dataset + * + * \dset_id + * + * \return \hid_t{dataset creation property list} + * + * \details H5Dget_create_plist() returns an identifier for + * a copy of the dataset creation property list associated with + * the dataset specified by \p dset_id. + * + * The creation property list identifier should be released + * with H5Pclose() to prevent resource leaks. + * + */ +H5_DLL hid_t H5Dget_create_plist(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Returns the dataset access property list associated with + * a dataset + * + * \dset_id + * + * \return \hid_t{dataset access property list} + * + * \details H5Dget_access_plist() returns a copy of the + * dataset access property list used to open the specified + * dataset, \p dset_id. Modifications to the returned property + * list will have no effect on the dataset it was retrieved from. + * + * The chunk cache parameters in the returned property lists will + * be those used by the dataset. If the properties in the file + * access property list were used to determine the dataset's + * chunk cache configuration, then those properties will be + * present in the returned dataset access property list. If + * the dataset does not use a chunked layout, then the chunk + * cache properties will be set to the default. The chunk cache + * properties in the returned list are considered to be “set”, + * and any use of this list will override the corresponding + * properties in the file’s file access property list. + * + * All link access properties in the returned list will be set + * to the default values. + * + * The access property list identifier should be released with + * H5Pclose() when the identifier is no longer needed so that + * resource leaks will not develop. + * + * \since 1.8.3 + * + */ +H5_DLL hid_t H5Dget_access_plist(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Returns the amount of storage allocated for a dataset + * + * \dset_id + * + * \return Returns the amount of storage space, in bytes, or 0 (zero). + * + * \details H5Dget_storage_size() returns the amount of storage, + * in bytes, that is allocated in the file for the raw data of + * the dataset specified by \p dset_id. + * + * \note The amount of storage in this case is the storage + * allocated in the written file, which will typically differ + * from the space required to hold a dataset in working memory. + * + * \li For contiguous datasets, the returned size equals the current + * allocated size of the raw data. + * \li For unfiltered chunked datasets, the returned size is the + * number of allocated chunks times the chunk size. + * \li For filtered chunked datasets, the returned size is the + * space required to store the filtered data. For example, if a + * compression filter is in use, H5Dget_storage_size() will return + * the total space required to store the compressed chunks. + * + * H5Dget_storage_size() reports only the space required to store + * the data, not including that of any metadata. + * + * \attention H5Dget_storage_size() does not differentiate between 0 (zero), + * the value returned for the storage size of a dataset + * with no stored values, and 0 (zero), the value returned to + * indicate an error. + * + * \note Note that H5Dget_storage_size() is not generally an + * appropriate function to use when determining the amount + * of memory required to work with a dataset. In such + * circumstances, you must determine the number of data + * points in a dataset and the size of an individual data + * element. H5Sget_simple_extent_npoints() and H5Tget_size() + * can be used to get that information. + * + */ H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id); -H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); -H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks); -H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask, - haddr_t *addr, hsize_t *size); -H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord, - unsigned *filter_mask, haddr_t *addr, hsize_t *size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Returns the amount of storage allocated within the file for a + * raw data chunk in a dataset + * + * \dset_id + * \param[in] offset Logical offset in the dataset for the chunk to query + * \param[out] chunk_bytes The size in bytes for the chunk + * + * \return \herr_t + * + * \details H5Dget_chunk_storage_size() returns the size in bytes + * allocated in the file for a raw data chunk as specified by + * its logical \p offset in the dataset \p dset_id. The size is + * returned in \p chunk_nbytes. It is the size of the compressed + * data if the chunk is filtered and the size may be zero if no + * storage is allocated yet for the dataset. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Retrieves number of chunks that have nonempty intersection with a + * specified selection + * + * \dset_id + * \param[in] fspace_id File dataspace selection identifier + * \param[out] nchunks Number of chunks in the selection + * + * \return \herr_t + * + * \details H5Dget_num_chunks() retrieves the number of chunks + * nchunks in a set of selected elements specified by \p fspace_id + * for a dataset specified by the identifier \p dset_id. If \p + * fspace_id is #H5S_ALL, the function will retrieve the total + * number of chunks stored for the dataset. + * + * \p fspace_id specifies the file dataspace selection. It is + * intended to take #H5S_ALL for specifying the current selection. + * + * \note Please be aware that this function currently does not + * support non-trivial selections, thus \p fspace_id has no + * effect. Also, the implementation does not handle the #H5S_ALL + * macro correctly. As a workaround, application can get + * the dataspace for the dataset using H5Dget_space() and pass that + * in for \p fspace_id. This will be fixed in coming releases. + * + * \since 1.10.5 + * + */ +H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Retrieves information about a chunk specified by its coordinates + * + * \dset_id + * \param[in] offset Logical position of the chunk’s first element + * \param[out] filter_mask Indicating filters used with the chunk when written + * \param[out] addr Chunk address in the file + * \param[out] size Chunk size in bytes, 0 if chunk doesn’t exist + * + * \return \herr_t + * + * \details H5Dget_chunk_info_by_coord() retrieves the \p filter_mask, \p size, + * and \p addr for a chunk in the dataset specified by \p dset_id, + * using the coordinates specified by \p offset. + * + * If the queried chunk does not exist in the file, \p size will + * be set to 0, \p addr to \c HADDR_UNDEF, and the buffer \p + * filter_mask will not be modified. + * + * \p offset is a pointer to a one-dimensional array with a size + * equal to the dataset’s rank. Each element is the logical + * position of the chunk’s first element in a dimension. + * + * \since 1.10.5 + * + */ +H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask, + haddr_t *addr, hsize_t *size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Retrieves information about a chunk specified by its index + * + * \dset_id + * \param[in] fspace_id File dataspace selection identifier (See Note below) + * \param[in] chk_idx Index of the chunk + * \param[out] offset Logical position of the chunk’s first element + * \param[out] filter_mask Indicating filters used with the chunk when written + * \param[out] addr Chunk address in the file + * \param[out] size Chunk size in bytes, 0 if chunk doesn’t exist + * + * \return \herr_t + * + * \details H5Dget_chunk_info() retrieves the offset coordinates + * offset, filter mask filter_mask, size size and address addr for + * the dataset specified by the identifier dset_id and the chunk + * specified by the index index. The chunk belongs to a set of + * chunks in the selection specified by fspace_id. If the queried + * chunk does not exist in the file, the size will be set to 0 and + * address to \c HADDR_UNDEF. The value pointed to by filter_mask will + * not be modified. NULL can be passed in for any \p out parameters. + * + * \p chk_idx is the chunk index in the selection. Index value + * may have a value of 0 up to the number of chunks stored in + * the file that have a nonempty intersection with the file + * dataspace selection + * + * \note As of 1.10.5, the dataspace intersection is not yet + * supported, hence, the index is of all the written chunks. + * + * \p fspace_id specifies the file dataspace selection. It is + * intended to take #H5S_ALL for specifying the current selection. + * + * \note Please be aware that this function currently does not + * support non-trivial selections, thus \p fspace_id has no + * effect. Also, the implementation does not handle the #H5S_ALL + * macro correctly. As a workaround, application can get + * the dataspace for the dataset using H5Dget_space() and pass that + * in for \p fspace_id. This will be fixed in coming releases. + * + * \since 1.10.5 + * + */ +H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *offset, + unsigned *filter_mask, haddr_t *addr, hsize_t *size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Returns dataset address in file + * + * \dset_id + * + * \return Returns the offset in bytes; otherwise, returns \c HADDR_UNDEF, + * a negative value. + * + * \details H5Dget_offset() returns the address in the file of + * the dataset, \p dset_id. That address is expressed as the + * offset in bytes from the beginning of the file. + * + * \since 1.6.0 + * + */ H5_DLL haddr_t H5Dget_offset(hid_t dset_id); -H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, void *buf /*out*/); -H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, const void *buf); -H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, - size_t data_size, const void *buf); -H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, - void *buf); -H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data); -H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size); -H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, hid_t buf_type, hid_t space); -H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); -H5_DLL herr_t H5Dflush(hid_t dset_id); -H5_DLL herr_t H5Drefresh(hid_t dset_id); -H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, - void *dst_buf); -H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size, - void *dst_buf, H5D_gather_func_t op, void *op_data); -H5_DLL herr_t H5Dclose(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Reads raw data from a dataset into a provided buffer + * + * \dset_id Identifier of the dataset to read from + * \param[in] mem_type_id Identifier of the memory datatype + * \param[in] mem_space_id Identifier of the memory dataspace + * \param[in] file_space_id Identifier of the dataset's dataspace in the file + * \param[in] dxpl_id Identifier of a transfer property list + * \param[out] buf Buffer to receive data read from file + * + * \return \herr_t + * + * \details H5Dread() reads a dataset, specified by its identifier + * \p dset_id, from the file into an application memory buffer \p + * buf. Data transfer properties are defined by the argument \p + * dxpl_id. The memory datatype of the (partial) dataset + * is identified by the identifier \p mem_type_id. The part + * of the dataset to read is defined by \p mem_space_id and \p + * file_space_id. + * + * \p file_space_id is used to specify only the selection within + * the file dataset's dataspace. Any dataspace specified in \p + * file_space_id is ignored by the library and the dataset's + * dataspace is always used. \p file_space_id can be the constant + * #H5S_ALL, which indicates that the entire file dataspace, + * as defined by the current dimensions of the dataset, is to + * be selected. + * + * \p mem_space_id is used to specify both the memory dataspace + * and the selection within that dataspace. \p mem_space_id can + * be the constant #H5S_ALL, in which case the file dataspace is + * used for the memory dataspace and the selection defined with \p + * file_space_id is used for the selection within that dataspace. + * + * If raw data storage space has not been allocated for the dataset + * and a fill value has been defined, the returned buffer \p buf + * is filled with the fill value. + * + * The behavior of the library for the various combinations of + * valid dataspace identifiers and #H5S_ALL for the \p mem_space_id + * and the \p file_space_id parameters is described below: + * + * <table> + * <tr> + * <th>mem_space_id</th> + * <th>file_space_id</th> + * <th>Behavior</th> + * </tr> + * <tr> + * <td>valid dataspace ID</td> + * <td>valid dataspace ID</td> + * <td>\p mem_space_id specifies the memory dataspace and the + * selection within it. \p file_space_id specifies the + * selection within the file dataset's dataspace.</td> + * </tr> + * <tr> + * <td>#H5S_ALL</td> + * <td>valid dataspace ID</td> + * <td>The file dataset's dataspace is used for the memory + * dataspace and the selection specified with \p file_space_id + * specifies the selection within it. The combination of the + * file dataset's dataspace and the selection from + * \p file_space_id is used for memory also.</td> + * </tr> + * <tr> + * <td>valid dataspace ID</td> + * <td>#H5S_ALL</td> + * <td>\p mem_space_id specifies the memory dataspace and the + * selection within it. The selection within the file + * dataset's dataspace is set to the "all" selection.</td> + * </tr> + * <tr> + * <td>#H5S_ALL</td> + * <td>#H5S_ALL</td> + * <td>The file dataset's dataspace is used for the memory + * dataspace and the selection within the memory dataspace + * is set to the "all" selection. The selection within the + * file dataset's dataspace is set to the "all" selection.</td> + * </tr> + * </table> + * + * \details Setting an #H5S_ALL selection indicates that the entire + * dataspace, as defined by the current dimensions of a dataspace, + * will be selected. The number of elements selected in the memory + * dataspace must match the number of elements selected in the + * file dataspace. + * + * \p dxpl_id can be the constant #H5P_DEFAULT, in which case the + * default data transfer properties are used. + * + */ +H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t dxpl_id, void *buf /*out*/); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Writes raw data from a buffer to a dataset + * + * \param[in] dset_id Identifier of the dataset to read from + * \param[in] mem_type_id Identifier of the memory datatype + * \param[in] mem_space_id Identifier of the memory dataspace + * \param[in] file_space_id Identifier of the dataset's dataspace in the file + * \dxpl_id + * \param[out] buf Buffer with data to be written to the file + * + * \return \herr_t + * + * \details H5Dwrite() writes a (partial) dataset, specified by + * its identifier \p dset_id, from the application memory buffer \p + * buf into the file. Data transfer properties are defined by the + * argument \p dxpl_id. The memory datatype of the (partial) + * dataset is identified by the identifier \p mem_type_id. The + * part of the dataset to write is defined by \p mem_space_id + * and \p file_space_id. + * + * If \p mem_type_id is either a fixed-length or variable-length + * string, it is important to set the string length when defining + * the datatype. String datatypes are derived from #H5T_C_S1 + * (or #H5T_FORTRAN_S1 for Fortran codes), which defaults + * to 1 character in size. See H5Tset_size() and Creating + * variable-length string datatypes. + * + * \p file_space_id is used to specify only the selection within + * the file dataset's dataspace. Any dataspace specified in \p + * file_space_id is ignored by the library and the dataset's + * dataspace is always used. \p file_space_id can be the constant + * #H5S_ALL, which indicates that the entire file dataspace, + * as defined by the current dimensions of the dataset, is to + * be selected. + * + * \p mem_space_id is used to specify both the memory dataspace + * and the selection within that dataspace. mem_space_id can be + * the constant #H5S_ALL, in which case the file dataspace is + * used for the memory dataspace and the selection defined with \p + * file_space_id is used for the selection within that dataspace. + * + * The behavior of the library for the various combinations of + * valid dataspace IDs and #H5S_ALL for the mem_space_id and + * thefile_space_id parameters is described below: + * + * <table> + * <tr><th>\c mem_space_id</th> + * <th>\c file_space_id</th> + * <th>Behavior</th></tr> + * <tr><td>valid dataspace ID</td> + * <td>valid dataspace ID</td> + * <td>\p mem_space_id specifies the memory dataspace and the + * selection within it. \p file_space_id specifies the + * selection within the file dataset's dataspace.</td></tr> + * <tr><td>#H5S_ALL</td> + * <td>valid dataspace ID</td> + * <td>The file dataset's dataspace is used for the memory + * dataspace and the selection specified with \p file_space_id + * specifies the selection within it. The combination of the + * file dataset's dataspace and the selection from \p + * file_space_id is used for memory also. valid dataspace + * ID</td></tr> + * <tr><td>valid dataspace ID</td> + * <td>#H5S_ALL</td> + * <td>\p mem_space_id specifies the memory dataspace and the + * selection within it. The selection within the file + * dataset's dataspace is set to "all" selection.</td></tr> + * <tr><td>#H5S_ALL</td> + * <td>#H5S_ALL</td> + * <td>The file dataset's dataspace is used for the memory + * dataspace and the selection within the memory dataspace is + * set to the "all" selection. The selection within the file + * dataset's dataspace is set to the "all" + * selection.</td></tr> + * </table> + * Setting an "all" selection indicates that the entire dataspace, + * as defined by the current dimensions of a dataspace, will + * be selected. The number of elements selected in the memory + * dataspace must match the number of elements selected in the + * file dataspace. + * + * \p dxpl_id can be the constant #H5P_DEFAULT, in which + * case the default data transfer properties are used. + * + * Writing to a dataset will fail if the HDF5 file was not opened + * with write access permissions. + * + * If the dataset's space allocation time is set to + * #H5D_ALLOC_TIME_LATE or #H5D_ALLOC_TIME_INCR and the space for + * the dataset has not yet been allocated, that space is allocated + * when the first raw data is written to the dataset. Unused space + * in the dataset will be written with fill values at the same + * time if the dataset's fill time is set to #H5D_FILL_TIME_IFSET + * or #H5D_FILL_TIME_ALLOC. + * + * \attention If a dataset's storage layout is 'compact', care must be + * taken when writing data to the dataset in parallel. A compact + * dataset's raw data is cached in memory and may be flushed + * to the file from any of the parallel processes, so parallel + * applications should always attempt to write identical data to + * the dataset from all processes. + * + * \see H5Pset_fill_time(), H5Pset_alloc_time() + * + */ +H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t dxpl_id, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Writes a raw data chunk from a buffer directly to a dataset in a file + * + * \dset_id + * \dxpl_id + * \param[in] filters Mask for identifying the filters in use + * \param[in] offset Logical position of the chunk’s first element in the + * dataspace + * \param[in] data_size Size of the actual data to be written in bytes + * \param[in] buf Buffer containing data to be written to the chunk + * + * \return \herr_t + * + * \details H5Dwrite_chunk() writes a raw data chunk as specified + * by its logical offset \p offset in a chunked dataset \p dset_id + * from the application memory buffer \p buf to the dataset in + * the file. Typically, the data in \p buf is preprocessed in + * memory by a custom transformation, such as compression. The + * chunk will bypass the library’s internal data transfer + * pipeline, including filters, and will be written directly to + * the file. Only one chunk can be written with this function. + * + * H5Dwrite_chunk() replaces the now deprecated H5DOwrite_chunk() + * function, which was located in the high level optimization + * library. The parameters and behavior are identical to the + * original. + * + * \p filters is a mask providing a record of which filters are + * used with the the chunk. The default value of the mask is + * zero (0), indicating that all enabled filters are applied. A + * filter is skipped if the bit corresponding to the filter’s + * position in the pipeline (0 ≤ position < 32) is turned on. + * This mask is saved with the chunk in the file. + * + * \p offset is an array specifying the logical position of the + * first element of the chunk in the dataset’s dataspace. The + * length of the offset array must equal the number of dimensions, + * or rank, of the dataspace. The values in offset must not exceed + * the dimension limits and must specify a point that falls on + * a dataset chunk boundary. + * + * \p data_size is the size in bytes of the chunk, representing + * the number of bytes to be read from the buffer \p buf. If the + * data chunk has been precompressed, \p data_size should be the + * size of the compressed data. + * + * \p buf is the memory buffer containing data to be written to + * the chunk in the file. + * + * \attention Exercise caution when using H5Dread_chunk() and + * H5Dwrite_chunk(), as they read and write data chunks directly + * in a file. H5Dwrite_chunk() bypasses hyperslab selection, the + * conversion of data from one datatype to another, and the filter + * pipeline to write the chunk. Developers should have experience + * with these processes before using this function. Please see + * Using the Direct Chunk Write Function for more information. + * + * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under + * parallel and do not support variable length types. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, + size_t data_size, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Reads a raw data chunk directly from a dataset in a file into + * a buffer + * + * \dset_id + * \dxpl_id + * \param[in] offset Logical position of the chunk’s first element in the + * dataspace + * \param[in,out] filters Mask for identifying the filters in use + * \param[out] buf Buffer containing data to be written to the chunk + * + * \return \herr_t + * + * \details H5Dread_chunk() reads a raw data chunk as specified by + * its logical offset \p offset in a chunked dataset \p dset_id + * from the dataset in the file into the application memory + * buffer \p buf. The data in \p buf is read directly from the + * file bypassing the library’s internal data transfer pipeline, + * including filters. + * + * \p offset is an array specifying the logical position of the + * first element of the chunk in the dataset’s dataspace. The + * length of the \p offset array must equal the number of dimensions, + * or rank, of the dataspace. The values in \p offset must not exceed + * the dimension limits and must specify a point that falls on + * a dataset chunk boundary. + * + * The mask \p filters indicates which filters are used with the + * chunk when written. A zero value indicates that all enabled + * filters are applied on the chunk. A filter is skipped if the + * bit corresponding to the filter’s position in the pipeline + * (0 ≤ position < 32) is turned on. + * + * \p buf is the memory buffer containing the chunk read from + * the dataset in the file. + * + * \attention Exercise caution when using H5Dread_chunk() and + * H5Dwrite_chunk(), as they read and write data chunks directly + * in a file. H5Dwrite_chunk() bypasses hyperslab selection, the + * conversion of data from one datatype to another, and the filter + * pipeline to write the chunk. Developers should have experience + * with these processes before using this function. Please see + * Using the Direct Chunk Write Function for more information. + * + * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under + * parallel and do not support variable length types. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, + void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Iterates over all selected elements in a dataspace + * + * \param[in,out] buf Buffer containing the elements to iterate over + * \type_id + * \space_id + * \param[in] op Function pointer + * \param[in,out] operator_data User-defined data + * + * \return \success{The return value of the first operator that returns + * non-zero, or zero if all members were processed with no + * operator returning non-zero.} + * \return \failure{Negative if an error occurs in the library, or the negative + * value returned by one of the operators.} + * + * \details H5Diterate() iterates over all the data elements + * in the memory buffer \p buf, executing the callback function + * \p op once for each such data element. + * + * The prototype of the callback function \p op is as follows + * (as defined in the source code file H5Lpublic.h): + * \snippet this H5D_operator_t_snip + * The parameters of this callback function are: + * + * <table> + * <tr><td>\c elem</td> + * <td><tt>[in,out]</tt></td> + * <td>Pointer to the memory buffer containing the current + * data element</td></tr> + * <tr><td>\c type_id</td> + * <td><tt>[in]</tt></td> + * <td>Datatype identifier of the elements stored in elem</td></tr> + * <tr><td>\c ndim</td> + * <td><tt>[in]</tt></td> + * <td>Number of dimensions for the point array</td></tr> + * <tr><td>\c point</td> + * <td><tt>[in]</tt></td> + * <td>Array containing the location of the element within + * the original dataspace</td></tr> + * <tr><td>\c operator_data</td> + * <td><tt>[in,out]</tt></td> + * <td>Pointer to any user-defined data associated with the + * operation</td></tr> + * </table> + * + * The possible return values from the callback function, and + * the effect ofeach,are as follows: + * + * \li Zero causes the iterator to continue, returning zero + * when all data elements have been processed. + * \li A positive value causes the iterator to immediately + * return that positive value, indicating short-circuit success. + * \li A negative value causes the iterator to immediately return + * that value, indicating failure. + * + * The \p operator_data parameter is a user-defined pointer to + * the data required to process dataset elements in the course + * of the iteration. If operator needs to pass data back to the + * application, such data can be returned in this same buffer. This + * pointer is passed back to each step of the iteration in the + * operator callback function’s operator_data parameter. + * + * Unlike other HDF5 iterators, this iteration operation cannot + * be restarted at the point of exit; a second H5Diterate() + * call will always restart at the beginning. + * + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Determines the number of bytes required to store variable-length + * (VL) data + * + * \dset_id + * \type_id + * \space_id + * \param[out] size Size in bytes of the memory buffer required to store + * the VL data + * + * \return \herr_t + * + * \details H5Dvlen_get_buf_size() determines the number of bytes + * required to store the VL data from the dataset, using \p + * space_id for the selection in the dataset on disk and the \p + * type_id for the memory representation of the VL data in memory. + * \p size is returned with the number of bytes required to store + * the VL data in memory. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dset_id, hid_t type_id, hid_t space_id, hsize_t *size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Fills dataspace elements with a fill value in a memory buffer + * + * \param[in] fill Pointer to the fill value to be used + * \param[in] fill_type_id Fill value datatype identifier + * \param[in,out] buf Pointer to the memory buffer containing the + * selection to be filled + * \param[in] buf_type_id Datatype of dataspace elements to be filled + * \space_id + * + * \return \herr_t + * + * \details H5Dfill() fills the dataspace selection in memory, \p space_id, + * with the fill value specified in \p fill. If \p fill is NULL, + * a fill value of 0 (zero) is used. + * + * \p fill_type_id specifies the datatype of the fill value. + * \p buf specifies the buffer in which the dataspace elements + * will be written. + * \p buf_type_id specifies the datatype of those data elements. + * + * \note Note that if the fill value datatype differs from the memory + * buffer datatype, the fill value will be converted to the memory + * buffer datatype before filling the selection. + * + * \note Applications sometimes write data only to portions of an + * allocated dataset. It is often useful in such cases to fill + * the unused space with a known fill value. See the following + * function for more information: + * - H5Pset_fill_value() + * - H5Pget_fill_value() + * - H5Pfill_value_defined() + * - H5Pset_fill_time() + * - H5Pget_fill_time() + * - H5Pcreate() + * - H5Pcreate_anon() + * + */ +H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_t space_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Changes the sizes of a dataset’s dimensions + * + * \dset_id + * \param[in] size[] Array containing the new magnitude of each dimension + * of the dataset + * + * \return \herr_t + * + * \details H5Dset_extent() sets the current dimensions of the + * chunked dataset \p dset_id to the sizes specified in size. + * + * \p size is a 1-dimensional array with n elements, where \p n is + * the rank of the dataset’s current dataspace. + * + * This function can be applied to the following datasets: + * - A chunked dataset with unlimited dimensions + * - A chunked dataset with fixed dimensions if the new dimension + * sizes are less than the maximum sizes set with maxdims (see + * H5Screate_simple()) + * - An external dataset with unlimited dimensions + * - An external dataset with fixed dimensions if the new dimension + * sizes are less than the maximum sizes set with \p maxdims + * + * Note that external datasets are always contiguous and can be + * extended only along the first dimension. + * + * Space on disk is immediately allocated for the new dataset extent if + * the dataset’s space allocation time is set to #H5D_ALLOC_TIME_EARLY. + * + * Fill values will be written to the dataset in either of the + * following situations, but not otherwise: + * + * - If the dataset’s fill time is set to #H5D_FILL_TIME_IFSET and a + * fill value is defined (see H5Pset_fill_time() and + * H5Pset_fill_value()) + * - If the dataset’s fill time is set to #H5D_FILL_TIME_ALLOC + * (see H5Pset_alloc_time()) + * + * \note + * \li If the sizes specified in \p size array are smaller than + * the dataset’s current dimension sizes, H5Dset_extent() will reduce + * the dataset’s dimension sizes to the specified values. It is the + * user application’s responsibility to ensure that valuable data is + * not lost as H5Dset_extent() does not check. + * + * \li Except for external datasets, H5Dset_extent() is for use with + * chunked datasets only, not contiguous datasets. + * + * \li A call to H5Dset_extent() affects the dataspace of a dataset. + * If a dataspace handle was opened for a dataset prior to a call to + * H5Dset_extent() then that dataspace handle will no longer reflect + * the correct dataspace extent of the dataset. H5Dget_space() must + * be called (after closing the previous handle) to obtain the current + * dataspace extent. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Flushes all buffers associated with a dataset to disk + * + * \dset_id + * + * \return \herr_t + * + * \details H5Dflush() causes all buffers associated with a + * dataset to be immediately flushed to disk without removing + * the data from the cache. + * + * \note HDF5 does not possess full control over buffering. + * H5Dflush() flushes the internal HDF5 buffers and then asks the + * operating system (the OS) to flush the system buffers for the + * open files. After that, the OS is responsible for ensuring + * that the data is actually flushed to disk. + * + */ +H5_DLL herr_t H5Dflush(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Refreshes all buffers associated with a dataset + * + * \dset_id + * + * \return \herr_t + * + * \details H5Drefresh() causes all buffers associated with a + * dataset to be cleared and immediately re-loaded with updated + * contents from disk. + * + * This function essentially closes the dataset, evicts all + * metadata associated with it from the cache, and then re-opens + * the dataset. The reopened dataset is automatically re-registered + * with the same identifier. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Drefresh(hid_t dset_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Scatters data into a selection within a memory buffer + * + * \param[in] op Callback function which provides data to be scattered + * \param[in] op_data User-defined pointer to data required by op + * \param[in] type_id Identifier for the datatype describing the data in + * both the source and destination buffers + * \param[in] dst_space_id Identifier for the dataspace for destination + * \param[out] dst_buf Destination buffer which the data will be scattered to + * + * \return \herr_t + * + * \details H5Dscatter() retrieves data from the supplied callback + * \p op and scatters it to the supplied buffer \p dst_buf in a + * manner similar to data being written to a dataset. + * + * \p dst_space_id is a dataspace which defines the extent of \p + * dst_buf and the selection within it to scatter the data to. + * + * \p type_id is the datatype of the data to be scattered in both + * the source and destination buffers. + * + * \p dst_buf must be at least as large as the number of elements + * in the extent of \p dst_space_id times the size in bytes of + * \p type_id. + * + * To retrieve the data to be scattered, H5Dscatter() repeatedly + * calls \p op, which should return a valid source buffer, until + * enough data to fill the selection has been retrieved. The + * prototype of the callback function \p op is as follows (as + * defined in the source code file H5Dpublic.h): + * \snippet this H5D_scatter_func_t_snip + * The parameters of this callback function are described below: + * + * <table> + * <tr><td>\c src_buf</td> + * <td><tt>[out]</tt></td> + * <td>Pointer to the buffer holding the next set of elements to + * scatter. On entry, the value of where \c src_buf points to + * is undefined. The callback function should set \c src_buf + * to point to the next set of elements.</td></tr> + * <tr><td>\c src_buf_bytes_used</td> + * <td><tt>[out]</tt></td> + * <td>Pointer to the number of valid bytes in \c src_buf. On + * entry, the value where \c src_buf_bytes_used points to is + * undefined. The callback function should set + * \c src_buf_bytes_used to the of valid bytes in \c src_buf. + * This number must be a multiple of the datatype size. + * </td></tr> + * <tr><td>\c op_data</td> + * <td><tt>[in,out]</tt></td> + * <td>User-defined pointer to data required by the callback + * function. A pass-through of the \c op_data pointer provided + * with the H5Dscatter() function call.</td></tr> + * </table> + * + * The callback function should always return at least one + * element in \p src_buf, and must not return more elements + * than are remaining to be scattered. This function will be + * repeatedly called until all elements to be scattered have + * been returned. The callback function should return zero (0) + * to indicate success, and a negative value to indicate failure. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, + void *dst_buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Gathers data from a selection within a memory buffer + * raw data chunk in a dataset + * + * \param[in] src_space_id Dataspace identifier for the source buffer + * \param[in] src_buf Source buffer which the data will be gathered from + * \param[in] type_id Datatype identifier for the source + * \param[in] dst_buf_size Size in bytes of \p dst_buf + * \param[out] dst_buf Destination buffer for the gathered data + * \param[in] op Callback function which handles the gathered data + * \param[in] op_data User-defined pointer to data required by \p op + * + * \return \herr_t + * + * \details H5Dgather() retrieves data from a selection within the supplied + * buffer src_buf and passes it to the supplied callback function + * \p op in a contiguous form. + * + * The dataspace \p src_space_id describes both the dimensions of + * the source buffer and the selection within the source buffer + * to gather data from. + * + * \p src_buf must be at least the size of the gathered data, that + * is, the number of elements in the extent of \p src_space_id + * times the size in bytes of \p type_id. + * + * The datatype \p type_id describes the data in both the source + * and destination buffers. This information is used to calculate + * the element size. + * + * The data is gathered into \p dst_buf, which needs to be large + * enough to hold all the data if the callback function \p op is + * not provided. + * + * \p op is a callback function which handles the gathered data. + * It is optional if \p dst_buf is large enough to hold all of the + * gathered data; required otherwise. + * + * If no callback function is provided, H5Dgather() simply gathers + * the data into \p dst_buf and returns. If a callback function is + * provided, H5Dgather() repeatedly gathers up to \p dst_buf_size + * bytes to process the serialized data. The prototype of the + * callback function \p op is as follows (as defined in the source + * code file H5Dpublic.h): + * \snippet this H5D_gather_func_t_snip + * The parameters of this callback function are described in the + * table below. + * <table> + * <tr><td>\c dst_buf</td> + * <td>Pointer to the destination buffer which has been filled + * with the next set of elements gathered. This will always be + * identical to the \p dst_buf passed to H5Dgather().</td></tr> + * <tr><td>\c dst_buf_bytes_used</td> + * <td>Pointer to the number of valid bytes in \p dst_buf. + * This number must be a multiple of the datatype + * size.</td></tr> + * <tr><td>\c op_data</td> + * <td>User-defined pointer to data required by the callback + * function; a pass-through of the \p op_data pointer + * provided with the H5Dgather() function call.</td></tr> + * </table> + * The callback function should process, store, or otherwise, + * make use of the data returned in \p dst_buf before it returns, + * because the buffer will be overwritten unless it is the last + * call to the callback. This function will be repeatedly called + * until all gathered elements have been passed to the callback + * in \p dst_buf. The callback function should return zero (0) + * to indicate success, and a negative value to indicate failure. + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf_size, + void *dst_buf, H5D_gather_func_t op, void *op_data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Closes the specified dataset + * + * \dset_id + * + * \return \herr_t + * + * \details H5Dclose() ends access to a dataset specified by \p dset_id + * and releases resources used by it. + * + * \attention Further use of a released dataset identifier is illegal; a + * function using such an identifier will generate an error. + * + * \since 1.8.0 + * + * \see H5Dcreate2(), H5Dopen2() + * + */ +H5_DLL herr_t H5Dclose(hid_t dset_id); /* Internal API routines */ H5_DLL herr_t H5Ddebug(hid_t dset_id); @@ -194,10 +1462,182 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); /* Typedefs */ /* Function prototypes */ -H5_DLL hid_t H5Dcreate1(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id); -H5_DLL hid_t H5Dopen1(hid_t file_id, const char *name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Creates a dataset at the specified location + * + * \fgdta_loc_id + * \param[in] name Name of the dataset to create + * \type_id + * \space_id + * \dcpl_id + * + * \return \hid_t{dataset} + * + * \deprecated This function is deprecated in favor of the function H5Dcreate2() + * or the macro H5Dcreate(). + * + * \details H5Dcreate1() creates a data set with a name, \p name, in the + * location specified by the identifier \p loc_id. \p loc_id may be a + * file, group, dataset, named datatype or attribute. If an attribute, + * dataset, or named datatype is specified for \p loc_id then the + * dataset will be created at the location where the attribute, + * dataset, or named datatype is attached. + * + * \p name can be a relative path based at \p loc_id or an absolute + * path from the root of the file. Use of this function requires that + * any intermediate groups specified in the path already exist. + * + * The dataset’s datatype and dataspace are specified by \p type_id and + * \p space_id, respectively. These are the datatype and dataspace of + * the dataset as it will exist in the file, which may differ from the + * datatype and dataspace in application memory. + * + * Names within a group are unique: H5Dcreate1() will return an error + * if a link with the name specified in name already exists at the + * location specified in \p loc_id. + * + * As is the case for any object in a group, the length of a dataset + * name is not limited. + * + * \p dcpl_id is an #H5P_DATASET_CREATE property list created with \p + * H5reate1() and initialized with various property list functions + * described in Property List Interface. + * + * H5Dcreate() and H5Dcreate_anon() return an error if the dataset’s + * datatype includes a variable-length (VL) datatype and the fill value + * is undefined, i.e., set to \c NULL in the dataset creation property + * list. Such a VL datatype may be directly included, indirectly + * included as part of a compound or array datatype, or indirectly + * included as part of a nested compound or array datatype. + * + * H5Dcreate() and H5Dcreate_anon() return a dataset identifier for + * success or a negative value for failure. The dataset identifier + * should eventually be closed by calling H5Dclose() to release + * resources it uses. + * + * See H5Dcreate_anon() for discussion of the differences between + * H5Dcreate() and H5Dcreate_anon(). + * + * The HDF5 library provides flexible means of specifying a fill value, + * of specifying when space will be allocated for a dataset, and of + * specifying when fill values will be written to a dataset. + * + * \version 1.8.0 Function H5Dcreate() renamed to H5Dcreate1() and deprecated in this release. + * \since 1.0.0 + * + * \see H5Dopen2(), H5Dclose(), H5Tset_size() + * + */ +H5_DLL hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Opens an existing dataset + * + * \fgdta_loc_id + * \param[in] name Name of the dataset to access + * + * \return \hid_t{dataset} + * + * \deprecated This function is deprecated in favor of the function H5Dopen2() + * or the macro H5Dopen(). + * + * \details H5Dopen1() opens an existing dataset for access at the location + * specified by \p loc_id. \p loc_id may be a file, group, dataset, + * named datatype or attribute. If an attribute, dataset, or named + * datatype is specified for loc_id then the dataset will be opened at + * the location where the attribute, dataset, or named datatype is + * attached. name is a dataset name and is used to identify the dataset + * in the file. + * + * A dataset opened with this function should be closed with H5Dclose() + * when the dataset is no longer needed so that resource leaks will not + * develop. + * + * \version 1.8.0 Function H5Dopen() renamed to H5Dopen1() and deprecated in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Extends a dataset + * + * \dset_id + * \param[in] size Array containing the new size of each dimension + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Dset_extent(). + * + * \details H5Dextend() verifies that the dataset is at least of size \p size, + * extending it if necessary. The dimensionality of size is the same as + * that of the dataspace of the dataset being changed. + * + * This function can be applied to the following datasets: + * \li Any dataset with unlimited dimensions + * \li A dataset with fixed dimensions if the current dimension sizes + * are less than the maximum sizes set with \c maxdims + * (see H5Screate_simple()) + * + * Space on disk is immediately allocated for the new dataset extent if + * the dataset’s space allocation time is set to + * #H5D_ALLOC_TIME_EARLY. Fill values will be written to the dataset if + * the dataset’s fill time is set to #H5D_FILL_TIME_IFSET or + * #H5D_FILL_TIME_ALLOC. (See H5Pset_fill_time() and + * H5Pset_alloc_time().) + * + * This function ensures that the dataset dimensions are of at least + * the sizes specified in size. The function H5Dset_extent() must be + * used if the dataset dimension sizes are are to be reduced. + * + * \version 1.8.0 Function Function deprecated in this release. Parameter size + * syntax changed to \Code{const hsize_t size[]} in this release. + * + */ H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]); -H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Reclaims variable-length (VL) datatype memory buffers + * + * \type_id + * \space_id + * \dxpl_id + * \param[in] buf Pointer to the buffer to be reclaimed + * + * \return \herr_t + * + * \deprecated This function has been deprecated in HDF5-1.12 in favor of the + * function H5Treclaim(). + * + * \details H5Dvlen_reclaim() reclaims memory buffers created to store VL + * datatypes. + * + * The \p type_id must be the datatype stored in the buffer. The \p + * space_id describes the selection for the memory buffer to free the + * VL datatypes within. The \p dxpl_id is the dataset transfer property + * list which was used for the I/O transfer to create the buffer. And + * \p buf is the pointer to the buffer to be reclaimed. + * + * The VL structures (\ref hvl_t) in the user's buffer are modified to + * zero out the VL information after the memory has been reclaimed. + * + * If nested VL datatypes were used to create the buffer, this routine + * frees them from the bottom up, releasing all the memory without + * creating memory leaks. + * + * \version 1.12.0 Routine was deprecated + * + */ +H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Emodule.h b/src/H5Emodule.h index 1670c03..43d5d36 100644 --- a/src/H5Emodule.h +++ b/src/H5Emodule.h @@ -29,4 +29,33 @@ #define H5_MY_PKG_ERR H5E_ERROR #define H5_MY_PKG_INIT YES +/** + * \defgroup H5E H5E + * \brief Error Handling Interface + * + * \details The Error interface provides error handling in the form of a stack. + * The \Code{FUNC_ENTER} macro clears the error stack whenever an + * interface function is entered. When an error is detected, an entry + * is pushed onto the stack. As the functions unwind, additional + * entries are pushed onto the stack. The API function will return some + * indication that an error occurred and the application can print the + * error stack. + * + * Certain API functions in the \c H5E package, such as H5Eprint1(), do + * not clear the error stack. Otherwise, any function which does not + * have an underscore immediately after the package name will clear the + * error stack. For instance, H5Fopen() clears the error stack while + * \Code{H5F_open} does not. + * + * An error stack has a fixed maximum size. If this size is exceeded + * then the stack will be truncated and only the inner-most functions + * will have entries on the stack. This is expected to be a rare + * condition. + * + * Each thread has its own error stack, but since multi-threading has + * not been added to the library yet, this package maintains a single + * error stack. The error stack is statically allocated to reduce the + * complexity of handling errors within the \c H5E package. + */ + #endif /* H5Emodule_H */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 9e53f54..2f529b3 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -26,18 +26,29 @@ /* Value for the default error stack */ #define H5E_DEFAULT (hid_t)0 -/* Different kinds of error information */ +/** + * Different kinds of error information + */ typedef enum H5E_type_t { H5E_MAJOR, H5E_MINOR } H5E_type_t; -/* Information about an error; element of error stack */ +/** + * Information about an error; element of error stack + */ typedef struct H5E_error2_t { - hid_t cls_id; /*class ID */ - hid_t maj_num; /*major error ID */ - hid_t min_num; /*minor error number */ - unsigned line; /*line in file where error occurs */ - const char *func_name; /*function in which error occurred */ - const char *file_name; /*file in which error occurred */ - const char *desc; /*optional supplied description */ + hid_t cls_id; + /**< Class ID */ + hid_t maj_num; + /**< Major error ID */ + hid_t min_num; + /**< Minor error number */ + unsigned line; + /**< Line in file where error occurs */ + const char *func_name; + /**< Function in which error occurred */ + const char *file_name; + /**< File in which error occurred */ + const char *desc; + /**< Optional supplied description */ } H5E_error2_t; /* When this header is included from a private header, don't make calls to H5open() */ @@ -138,10 +149,12 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; goto label; \ } -/* Error stack traversal direction */ +/** + * Error stack traversal direction + */ typedef enum H5E_direction_t { - H5E_WALK_UPWARD = 0, /*begin deep, end at API function */ - H5E_WALK_DOWNWARD = 1 /*begin at API function, end deep */ + H5E_WALK_UPWARD = 0, /**< begin w/ most specific error, end at API function */ + H5E_WALK_DOWNWARD = 1 /**< begin at API function, end w/ most specific error */ } H5E_direction_t; #ifdef __cplusplus @@ -149,29 +162,478 @@ extern "C" { #endif /* Error stack traversal callback function pointers */ +//! <!-- [H5E_walk2_t_snip] --> +/** + * \brief Callback function for H5Ewalk2() + * + * \param[in] n Indexed error position in the stack + * \param[in] err_desc Pointer to a data structure describing the error + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_walk2_t)(unsigned n, const H5E_error2_t *err_desc, void *client_data); +//! <!-- [H5E_walk2_t_snip] --> + +//! <!-- [H5E_auto2_t_snip] --> +/** + * \brief Callback function for H5Eset_auto2() + * + * \estack_id{estack} + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_auto2_t)(hid_t estack, void *client_data); +//! <!-- [H5E_auto2_t_snip] --> /* Public API functions */ -H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version); -H5_DLL herr_t H5Eunregister_class(hid_t class_id); -H5_DLL herr_t H5Eclose_msg(hid_t err_id); -H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); -H5_DLL hid_t H5Ecreate_stack(void); -H5_DLL hid_t H5Eget_current_stack(void); -H5_DLL herr_t H5Eclose_stack(hid_t stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Registers a client library or application program to the HDF5 error API + * + * \param[in] cls_name Name of the error class + * \param[in] lib_name Name of the client library or application to which the error class belongs + * \param[in] version Version of the client library or application to which the + error class belongs. Can be \c NULL. + * \return Returns a class identifier on success; otherwise returns H5I_INVALID_ID. + * + * \details H5Eregister_class() registers a client library or application + * program to the HDF5 error API so that the client library or + * application program can report errors together with the HDF5 + * library. It receives an identifier for this error class for further + * error operations. The library name and version number will be + * printed out in the error message as a preamble. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Eregister_class(const char *cls_name, const char *lib_name, const char *version); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Removes an error class + * + * \param[in] class_id Error class identifier. + * \return \herr_t + * + * \details H5Eunregister_class() removes the error class specified by \p + * class_id. All the major and minor errors in this class will also be + * closed. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eunregister_class(hid_t class_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Closes an error message + * + * \param[in] err_id An error message identifier + * \return \herr_t + * + * \details H5Eclose_msg() closes an error message identifier, which can be + * either a major or minor message. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eclose_msg(hid_t err_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Adds a major error message to an error class + * + * \param[in] cls An error class identifier + * \param[in] msg_type The type of the error message + * \param[in] msg Major error message + * \return \herr_t + * + * \details H5Ecreate_msg() adds an error message to an error class defined by + * client library or application program. The error message can be + * either major or minor as indicated by the parameter \p msg_type. + * + * Use H5Eclose_msg() to close the message identifier returned by this + * function. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Creates a new, empty error stack + * + * \return \hid_ti{error stack} + * + * \details H5Ecreate_stack() creates a new empty error stack and returns the + * new stack’s identifier. Use H5Eclose_stack() to close the error stack + * identifier returned by this function. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Ecreate_stack(void); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns a copy of the current error stack + * + * \return \hid_ti{error stack} + * + * \details H5Eget_current_stack() copies the current error stack and returns an + * error stack identifier for the new copy. + * + * \since 1.8.0 + */ +H5_DLL hid_t H5Eget_current_stack(void); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Closes an error stack handle + * + * \estack_id{stack_id} + * + * \return \herr_t + * + * \details H5Eclose_stack() closes the error stack handle \p stack_id + * and releases its resources. #H5E_DEFAULT cannot be closed. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eclose_stack(hid_t stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Retrieves error class name + * + * \param[in] class_id Error class identifier + * \param[out] name Buffer for the error class name + * \param[in] size The maximum number of characters the class name to be returned + * by this function in\p name. + * \return Returns non-negative value as on success; otherwise returns negative value. + * + * \details H5Eget_class_name() retrieves the name of the error class specified + * by the class identifier. If non-NULL pointer is passed in for \p + * name and \p size is greater than zero, the class name of \p size + * long is returned. The length of the error class name is also + * returned. If NULL is passed in as \p name, only the length of class + * name is returned. If zero is returned, it means no name. The user is + * responsible for allocating sufficient buffer space for the name. + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size); -H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); -H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, - hid_t maj_id, hid_t min_id, const char *msg, ...); -H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); -H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); -H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data); -H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data); -H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data); -H5_DLL herr_t H5Eclear2(hid_t err_stack); -H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Replaces the current error stack + * + * \estack_id{err_stack_id} + * + * \return \herr_t + * + * \details H5Eset_current_stack() replaces the content of the current error + * stack with a copy of the content of the error stack specified by + * \p err_stack_id, and it closes the error stack specified by + * \p err_stack_id. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Pushes a new error record onto an error stack + * + * \estack_id{err_stack}. If the identifier is #H5E_DEFAULT, the error record + * will be pushed to the current stack. + * \param[in] file Name of the file in which the error was detected + * \param[in] func Name of the function in which the error was detected + * \param[in] line Line number in the file where the error was detected + * \param[in] cls_id Error class identifier + * \param[in] maj_id Major error identifier + * \param[in] min_id Minor error identifier + * \param[in] msg Error description string + * \return \herr_t + * + * \details H5Epush2() pushes a new error record onto the error stack specified + * by \p err_stack.\n + * The error record contains the error class identifier \p cls_id, the + * major and minor message identifiers \p maj_id and \p min_id, the + * function name \p func where the error was detected, the file name \p + * file and line number \p line in the file where the error was + * detected, and an error description \p msg.\n + * The major and minor errors must be in the same error class.\n + * The function name, filename, and error description strings must be + * statically allocated.\n + * \p msg can be a format control string with additional + * arguments. This design of appending additional arguments is similar + * to the system and C functions printf() and fprintf(). + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, + hid_t maj_id, hid_t min_id, const char *msg, ...); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Deletes specified number of error messages from the error stack + * + * \estack_id{err_stack} + * \param[in] count The number of error messages to be deleted from the top + * of error stack + * \return \herr_t + * + * \details H5Epop() deletes the number of error records specified in \p count + * from the top of the error stack specified by \p err_stack (including + * major, minor messages and description). The number of error messages + * to be deleted is specified by \p count. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Prints the specified error stack in a default manner + * + * \estack_id{err_stack} + * \param[in] stream File pointer, or \c NULL for \c stderr + * \return \herr_t + * + * \details H5Eprint2() prints the error stack specified by \p err_stack on the + * specified stream, \p stream. Even if the error stack is empty, a + * one-line message of the following form will be printed: + * \code{.unparsed} + * HDF5-DIAG: Error detected in HDF5 library version: 1.5.62 thread 0. + * \endcode + * + * A similar line will appear before the error messages of each error + * class stating the library name, library version number, and thread + * identifier. + * + * If \p err_stack is #H5E_DEFAULT, the current error stack will be + * printed. + * + * H5Eprint2() is a convenience function for H5Ewalk2() with a function + * that prints error messages. Users are encouraged to write their own + * more specific error handlers. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Walks the specified error stack, calling the specified function + * + * \estack_id{err_stack} + * \param[in] direction Direction in which the error stack is to be walked + * \param[in] func Function to be called for each error encountered + * \param[in] client_data Data to be passed to \p func + * \return \herr_t + * + * \details H5Ewalk2() walks the error stack specified by err_stack for the + * current thread and calls the function specified in \p func for each + * error along the way. + * + * If the value of \p err_stack is #H5E_DEFAULT, then H5Ewalk2() walks + * the current error stack. + * + * \p direction specifies whether the stack is walked from the inside + * out or the outside in. A value of #H5E_WALK_UPWARD means to begin + * with the most specific error and end at the API; a value of + * #H5E_WALK_DOWNWARD means to start at the API and end at the + * innermost function where the error was first detected. + * + * \p func, a function conforming to the #H5E_walk2_t prototype, will + * be called for each error in the error stack. Its arguments will + * include an index number \c n (beginning at zero regardless of stack + * traversal direction), an error stack entry \c err_desc, and the \c + * client_data pointer passed to H5Eprint(). The #H5E_walk2_t prototype + * is as follows: + * \snippet this H5E_walk2_t_snip + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, void *client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns the settings for the automatic error stack traversal + * function and its data + * + * \estack_id + * \param[out] func The function currently set to be called upon an error condition + * \param[out] client_data Data currently set to be passed to the error function + * \return \herr_t + * + * \details H5Eget_auto2() returns the settings for the automatic error stack + * traversal function, \p func, and its data, \p client_data, that are + * associated with the error stack specified by \p estack_id. + * + * Either or both of the \p func and \p client_data arguments may be + * \c NULL, in which case the value is not returned. + * + * The library initializes its default error stack traversal functions + * to H5Eprint1() and H5Eprint2(). A call to H5Eget_auto2() returns + * H5Eprint2() or the user-defined function passed in through + * H5Eset_auto2(). A call to H5Eget_auto1() returns H5Eprint1() or the + * user-defined function passed in through H5Eset_auto1(). However, if + * the application passes in a user-defined function through + * H5Eset_auto1(), it should call H5Eget_auto1() to query the traversal + * function. If the application passes in a user-defined function + * through H5Eset_auto2(), it should call H5Eget_auto2() to query the + * traversal function. + * + * Mixing the new style and the old style functions will cause a + * failure. For example, if the application sets a user-defined + * old-style traversal function through H5Eset_auto1(), a call to + * H5Eget_auto2() will fail and will indicate that the application has + * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing + * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if + * the traversal functions are the library’s default H5Eprint1() or + * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing + * H5Eset_auto2() and H5Eget_auto1() does not fail. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func, void **client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Turns automatic error printing on or off + * + * \estack_id + * \param[in] func Function to be called upon an error condition + * \param[in] client_data Data passed to the error function + * \return \herr_t + * + * \details H5Eset_auto2() turns on or off automatic printing of errors for the + * error stack specified with \p estack_id. An \p estack_id value of + * #H5E_DEFAULT indicates the current stack. + * + * When automatic printing is turned on, by the use of a non-null \p func + * pointer, any API function which returns an error indication will + * first call \p func, passing it \p client_data as an argument. + * + * \p func, a function compliant with the #H5E_auto2_t prototype, is + * defined in the H5Epublic.h source code file as: + * \snippet this H5E_auto2_t_snip + * + * When the library is first initialized, the auto printing function is + * set to H5Eprint2() (cast appropriately) and \p client_data is the + * standard error stream pointer, \c stderr. + * + * Automatic stack traversal is always in the #H5E_WALK_DOWNWARD + * direction. + * + * Automatic error printing is turned off with a H5Eset_auto2() call + * with a \c NULL \p func pointer. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Clears the specified error stack or the error stack for the current thread + * + * \estack_id{err_stack} + * \return \herr_t + * + * \details H5Eclear2() clears the error stack specified by \p err_stack, or, if + * \p err_stack is set to #H5E_DEFAULT, the error stack for the current + * thread. + * + * \p err_stack is an error stack identifier, such as that returned by + * H5Eget_current_stack(). + * + * The current error stack is also cleared whenever an API function is + * called, with certain exceptions (for instance, H5Eprint1() or + * H5Eprint2()). + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eclear2(hid_t err_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Determines the type of error stack + * + * \estack_id{err_stack} + * \param[out] is_stack A flag indicating which error stack \c typedef the + * specified error stack conforms to + * + * \return \herr_t + * + * \details H5Eauto_is_v2() determines whether the error auto reporting function + * for an error stack conforms to the #H5E_auto2_t \c typedef or the + * #H5E_auto1_t \c typedef. + * + * The \p is_stack parameter is set to 1 if the error stack conforms to + * #H5E_auto2_t and 0 if it conforms to #H5E_auto1_t. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Eauto_is_v2(hid_t err_stack, unsigned *is_stack); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Retrieves an error message + * + * \param[in] msg_id Error message identifier + * \param[out] type The type of the error message Valid values are #H5E_MAJOR + * and #H5E_MINOR. + * \param[out] msg Error message buffer + * \param[in] size The length of error message to be returned by this function + * \return Returns the size of the error message in bytes on success; otherwise + * returns a negative value. + * + * \details H5Eget_msg() retrieves the error message including its length and + * type. The error message is specified by \p msg_id. The user is + * responsible for passing in sufficient buffer space for the + * message. If \p msg is not NULL and \p size is greater than zero, the + * error message of \p size long is returned. The length of the message + * is also returned. If NULL is passed in as \p msg, only the length + * and type of the message is returned. If the return value is zero, it + * means there is no message. + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Eget_msg(hid_t msg_id, H5E_type_t *type, char *msg, size_t size); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Retrieves the number of error messages in an error stack + * + * \estack_id{error_stack_id} + * \return Returns a non-negative value on success; otherwise returns a negative value. + * + * \details H5Eget_num() retrieves the number of error records in the error + * stack specified by \p error_stack_id (including major, minor + * messages and description). + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. @@ -188,30 +650,259 @@ H5_DLL ssize_t H5Eget_num(hid_t error_stack_id); typedef hid_t H5E_major_t; typedef hid_t H5E_minor_t; -/* Information about an error element of error stack. */ +/** + * Information about an error element of error stack. + */ typedef struct H5E_error1_t { - H5E_major_t maj_num; /*major error number */ - H5E_minor_t min_num; /*minor error number */ - const char *func_name; /*function in which error occurred */ - const char *file_name; /*file in which error occurred */ - unsigned line; /*line in file where error occurs */ - const char *desc; /*optional supplied description */ + H5E_major_t maj_num; /**< major error number */ + H5E_minor_t min_num; /**< minor error number */ + const char *func_name; /**< function in which error occurred */ + const char *file_name; /**< file in which error occurred */ + unsigned line; /**< line in file where error occurs */ + const char *desc; /**< optional supplied description */ } H5E_error1_t; /* Error stack traversal callback function pointers */ +//! <!-- [H5E_walk1_t_snip] --> +/** + * \brief Callback function for H5Ewalk1() + * + * \param[in] n Indexed error position in the stack + * \param[in] err_desc Pointer to a data structure describing the error + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_walk1_t)(int n, H5E_error1_t *err_desc, void *client_data); +//! <!-- [H5E_walk1_t_snip] --> + +//! <!-- [H5E_auto1_t_snip] --> +/** + * \brief Callback function for H5Eset_auto1() + * + * \param[in] client_data Pointer to client data in the format expected by the + * user-defined function + * \return \herr_t + */ typedef herr_t (*H5E_auto1_t)(void *client_data); +//! <!-- [H5E_auto1_t_snip] --> /* Function prototypes */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Clears the error stack for the current thread + * + * \return \herr_t + * + * \details H5Eclear1() clears the error stack for the current thread.\n + * The stack is also cleared whenever an API function is called, with + * certain exceptions (for instance, H5Eprint1()). + * + * \deprecated 1.8.0 Function H5Eclear() renamed to H5Eclear1() and deprecated + * in this release. + */ H5_DLL herr_t H5Eclear1(void); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns the current settings for the automatic error stack traversal + * function and its data + * + * \param[out] func Current setting for the function to be called upon an error + * condition + * \param[out] client_data Current setting for the data passed to the error + * function + * \return \herr_t + * + * \details H5Eget_auto1() returns the current settings for the automatic error + * stack traversal function, \p func, and its data, + * \p client_data. Either or both arguments may be \c NULL, in which case the + * value is not returned. + * + * The library initializes its default error stack traversal functions + * to H5Eprint1() and H5Eprint2(). A call to H5Eget_auto2() returns + * H5Eprint2() or the user-defined function passed in through + * H5Eset_auto2(). A call to H5Eget_auto1() returns H5Eprint1() or the + * user-defined function passed in through H5Eset_auto1(). However, if + * the application passes in a user-defined function through + * H5Eset_auto1(), it should call H5Eget_auto1() to query the traversal + * function. If the application passes in a user-defined function + * through H5Eset_auto2(), it should call H5Eget_auto2() to query the + * traversal function. + * + * Mixing the new style and the old style functions will cause a + * failure. For example, if the application sets a user-defined + * old-style traversal function through H5Eset_auto1(), a call to + * H5Eget_auto2() will fail and will indicate that the application has + * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing + * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if + * the traversal functions are the library’s default H5Eprint1() or + * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing + * H5Eset_auto2() and H5Eget_auto1() does not fail. + * + * \deprecated 1.8.0 Function H5Eget_auto() renamed to H5Eget_auto1() and + * deprecated in this release. + */ H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Pushes a new error record onto the error stack + * + * \param[in] file Name of the file in which the error was detected + * \param[in] func Name of the function in which the error was detected + * \param[in] line Line number in the file where the error was detected + * \param[in] maj Major error identifier + * \param[in] min Minor error identifier + * \param[in] str Error description string + * \return \herr_t + * + * \details H5Epush1() pushes a new error record onto the error stack for the + * current thread.\n + * The error has major and minor numbers \p maj_num + * and \p min_num, the function \p func where the error was detected, the + * name of the file \p file where the error was detected, the line \p line + * within that file, and an error description string \p str.\n + * The function name, filename, and error description strings must be statically + * allocated. + * + * \since 1.4.0 + * \deprecated 1.8.0 Function H5Epush() renamed to H5Epush1() and + * deprecated in this release. + */ H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min, const char *str); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Prints the current error stack in a default manner + * + * \param[in] stream File pointer, or \c NULL for \c stderr + * \return \herr_t + * + * \details H5Eprint1() prints prints the error stack for the current thread + * on the specified stream, \p stream. Even if the error stack is empty, a + * one-line message of the following form will be printed: + * \code{.unparsed} + * HDF5-DIAG: Error detected in thread 0. + * \endcode + * H5Eprint1() is a convenience function for H5Ewalk1() with a function + * that prints error messages. Users are encouraged to write their own + * more specific error handlers. + * + * \deprecated 1.8.0 Function H5Eprint() renamed to H5Eprint1() and + * deprecated in this release. + */ H5_DLL herr_t H5Eprint1(FILE *stream); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Turns automatic error printing on or off + * + * \param[in] func Function to be called upon an error condition + * \param[in] client_data Data passed to the error function + * \return \herr_t + * + * \details H5Eset_auto1() turns on or off automatic printing of errors. When + * turned on (non-null \p func pointer), any API function which returns + * an error indication will first call \p func, passing it \p + * client_data as an argument. + * + * \p func, a function conforming to the #H5E_auto1_t prototype, is + * defined in the H5Epublic.h source code file as: + * \snippet this H5E_auto1_t_snip + * + * When the library is first initialized, the auto printing function is + * set to H5Eprint1() (cast appropriately) and \p client_data is the + * standard error stream pointer, \c stderr. + * + * Automatic stack traversal is always in the #H5E_WALK_DOWNWARD + * direction. + * + * \deprecated 1.8.0 Function H5Eset_auto() renamed to H5Eset_auto1() and + * deprecated in this release. + */ H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Walks the current error stack, calling the specified function + * + * \param[in] direction Direction in which the error stack is to be walked + * \param[in] func Function to be called for each error encountered + * \param[in] client_data Data to be passed to \p func + * \return \herr_t + * + * \details H5Ewalk1() walks the error stack for the current thread and calls + * the function specified in \p func for each error along the way. + * + * \p direction specifies whether the stack is walked from the inside + * out or the outside in. A value of #H5E_WALK_UPWARD means to begin + * with the most specific error and end at the API; a value of + * #H5E_WALK_DOWNWARD means to start at the API and end at the + * innermost function where the error was first detected. + * + * \p func, a function conforming to the #H5E_walk1_t prototype, will + * be called for each error in the error stack. Its arguments will + * include an index number \c n (beginning at zero regardless of stack + * traversal direction), an error stack entry \c err_desc, and the \c + * client_data pointer passed to H5Eprint(). The #H5E_walk1_t prototype + * is as follows: + * \snippet this H5E_walk1_t_snip + * + * \deprecated 1.8.0 Function H5Ewalk() renamed to H5Ewalk1() and + * deprecated in this release. + */ H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data); -H5_DLL char * H5Eget_major(H5E_major_t maj); -H5_DLL char * H5Eget_minor(H5E_minor_t min); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns a character string describing an error specified by a major + * error number + * + * \param[in] maj Major error number + * \return \herr_t + * + * \details Given a major error number, H5Eget_major() returns a constant + * character string that describes the error. + * + * \attention This function returns a dynamically allocated string (\c char + * array). An application calling this function must free the memory + * associated with the return value to prevent a memory leak. + * + * \deprecated 1.8.0 Function deprecated in this release. + */ +H5_DLL char *H5Eget_major(H5E_major_t maj); +/** + * -------------------------------------------------------------------------- + * \ingroup H5E + * + * \brief Returns a character string describing an error specified by a minor + * error number + * + * \param[in] min Minor error number + * \return \herr_t + * + * \details Given a minor error number, H5Eget_minor() returns a constant + * character string that describes the error. + * + * \attention In the Release 1.8.x series, H5Eget_minor() returns a string of + * dynamic allocated \c char array. An application calling this + * function from an HDF5 library of Release 1.8.0 or later must free + * the memory associated with the return value to prevent a memory + * leak. This is a change from the 1.6.x release series. + * + * \deprecated 1.8.0 Function deprecated and return type changed in this release. + */ +H5_DLL char *H5Eget_minor(H5E_minor_t min); #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus diff --git a/src/H5FDcore.h b/src/H5FDcore.h index f8a516a..d456c3e 100644 --- a/src/H5FDcore.h +++ b/src/H5FDcore.h @@ -25,8 +25,70 @@ #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_core_init(void); +H5_DLL hid_t H5FD_core_init(void); + +/** + * \ingroup FAPL + * + * \brief Modifies the file access property list to use the #H5FD_CORE driver + * + * \fapl_id + * \param[in] increment Size, in bytes, of memory increments + * \param[in] backing_store Boolean flag indicating whether to write the file + * contents to disk when the file is closed + * \returns \herr_t + * + * \details H5Pset_fapl_core() modifies the file access property list to use the + * #H5FD_CORE driver. + * + * The #H5FD_CORE driver enables an application to work with a file in + * memory, speeding reads and writes as no disk access is made. File + * contents are stored only in memory until the file is closed. The \p + * backing_store parameter determines whether file contents are ever + * written to disk. + * + * \p increment specifies the increment by which allocated memory is to + * be increased each time more memory is required. + * + * While using H5Fcreate() to create a core file, if the \p + * backing_store is set to 1 (TRUE), the file contents are flushed to a + * file with the same name as this core file when the file is closed or + * access to the file is terminated in memory. + * + * The application is allowed to open an existing file with #H5FD_CORE + * driver. While using H5Fopen() to open an existing file, if the \p + * backing_store is set to 1 (TRUE) and the \c flags for H5Fopen() is set to + * #H5F_ACC_RDWR, any change to the file contents are saved to the file + * when the file is closed. If \p backing_store is set to 0 (FALSE) and the \c + * flags for H5Fopen() is set to #H5F_ACC_RDWR, any change to the file + * contents will be lost when the file is closed. If the flags for + * H5Fopen() is set to #H5F_ACC_RDONLY, no change to the file is + * allowed either in memory or on file. + * + * \note Currently this driver cannot create or open family or multi files. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store); + +/** + * \ingroup FAPL + * + * \brief Queries core file driver properties + * + * \fapl_id + * \param[out] increment Size, in bytes, of memory increments + * \param[out] backing_store Boolean flag indicating whether to write the file + * contents to disk when the file is closed + * \returns \herr_t + * + * \details H5Pget_fapl_core() queries the #H5FD_CORE driver properties as set + * by H5Pset_fapl_core(). + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/); #ifdef __cplusplus } diff --git a/src/H5FDdirect.h b/src/H5FDdirect.h index eec10de..f06de7f 100644 --- a/src/H5FDdirect.h +++ b/src/H5FDdirect.h @@ -37,8 +37,69 @@ extern "C" { #define FBSIZE_DEF 4096 #define CBSIZE_DEF 16 * 1024 * 1024 -H5_DLL hid_t H5FD_direct_init(void); +H5_DLL hid_t H5FD_direct_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up use of the direct I/O driver + * + * \fapl_id + * \param[in] alignment Required memory alignment boundary + * \param[in] block_size File system block size + * \param[in] cbuf_size Copy buffer size + * \returns \herr_t + * + * \details H5Pset_fapl_direct() sets the file access property list, \p fapl_id, + * to use the direct I/O driver, #H5FD_DIRECT. With this driver, data + * is written to or read from the file synchronously without being + * cached by the system. + * + * File systems usually require the data address in memory, the file + * address, and the size of the data to be aligned. The HDF5 library’s + * direct I/O driver is able to handle unaligned data, though that will + * consume some additional memory resources and may slow + * performance. To get better performance, use the system function \p + * posix_memalign to align the data buffer in memory and the HDF5 + * function H5Pset_alignment() to align the data in the file. Be aware, + * however, that aligned data I/O may cause the HDF5 file to be bigger + * than the actual data size would otherwise require because the + * alignment may leave some holes in the file. + * + * \p alignment specifies the required alignment boundary in memory. + * + * \p block_size specifies the file system block size. A value of 0 + * (zero) means to use HDF5 library’s default value of 4KB. + * + * \p cbuf_size specifies the copy buffer size. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t alignment, size_t block_size, size_t cbuf_size); + +/** + * \ingroup FAPL + * + * \brief Retrieves direct I/O driver settings + * + * \fapl_id + * \param[out] boundary Required memory alignment boundary + * \param[out] block_size File system block size + * \param[out] cbuf_size Copy buffer size + * \returns \herr_t + * + * \details H5Pget_fapl_direct() retrieves the required memory alignment (\p + * alignment), file system block size (\p block_size), and copy buffer + * size (\p cbuf_size) settings for the direct I/O driver, #H5FD_DIRECT, + * from the file access property list \p fapl_id. + * + * See H5Pset_fapl_direct() for discussion of these values, + * requirements, and important considerations. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size /*out*/, size_t *cbuf_size /*out*/); diff --git a/src/H5FDfamily.h b/src/H5FDfamily.h index f00836f..20ef532 100644 --- a/src/H5FDfamily.h +++ b/src/H5FDfamily.h @@ -26,8 +26,58 @@ extern "C" { #endif -H5_DLL hid_t H5FD_family_init(void); +H5_DLL hid_t H5FD_family_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets the file access property list to use the family driver + * + * \fapl_id + * \param[in] memb_size Size in bytes of each file member + * \param[in] memb_fapl_id Identifier of file access property list for + * each family member + * \returns \herr_t + * + * \details H5Pset_fapl_family() sets the file access property list identifier, + * \p fapl_id, to use the family driver. + * + * \p memb_size is the size in bytes of each file member. This size + * will be saved in file when the property list \p fapl_id is used to + * create a new file. If \p fapl_id is used to open an existing file, + * \p memb_size has to be equal to the original size saved in file. A + * failure with an error message indicating the correct member size + * will be returned if \p memb_size does not match the size saved. If + * any user does not know the original size, #H5F_FAMILY_DEFAULT can be + * passed in. The library will retrieve the saved size. + * + * \p memb_fapl_id is the identifier of the file access property list + * to be used for each family member. + * + * \version 1.8.0 Behavior of the \p memb_size parameter was changed. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id); + +/** + * \ingroup FAPL + * + * \brief Returns file access property list information + * + * \fapl_id + * \param[out] memb_size Size in bytes of each file member + * \param[out] memb_fapl_id Identifier of file access property list for + * each family member + * \returns \herr_t + * + * \details H5Pget_fapl_family() returns file access property list for use with + * the family driver. This information is returned through the output + * parameters. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size /*out*/, hid_t *memb_fapl_id /*out*/); #ifdef __cplusplus diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index 9e46954..219d0ac 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -111,8 +111,20 @@ typedef struct H5FD_hdfs_fapl_t { extern "C" { #endif -H5_DLL hid_t H5FD_hdfs_init(void); +H5_DLL hid_t H5FD_hdfs_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); #ifdef __cplusplus diff --git a/src/H5FDlog.h b/src/H5FDlog.h index aa1f3cb..969c091 100644 --- a/src/H5FDlog.h +++ b/src/H5FDlog.h @@ -65,7 +65,410 @@ extern "C" { #endif -H5_DLL hid_t H5FD_log_init(void); +H5_DLL hid_t H5FD_log_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up the logging virtual file driver (#H5FD_LOG) for use + * + * \fapl_id + * \param[in] logfile Name of the log file + * \param[in] flags Flags specifying the types of logging activity + * \param[in] buf_size The size of the logging buffers, in bytes (see description) + * \returns \herr_t + * + * \details H5Pset_fapl_log() modifies the file access property list to use the + * logging driver, #H5FD_LOG. The logging virtual file driver (VFD) is + * a clone of the standard SEC2 (#H5FD_SEC2) driver with additional + * facilities for logging VFD metrics and activity to a file. + * + * \p logfile is the name of the file in which the logging entries are + * to be recorded. + * + * The actions to be logged are specified in the parameter \p flags + * using the pre-defined constants described in the following + * table. Multiple flags can be set through the use of a logical \c OR + * contained in parentheses. For example, logging read and write + * locations would be specified as + * \Code{(H5FD_LOG_LOC_READ|H5FD_LOG_LOC_WRITE)}. + * + * <table> + * <caption>Table1: Logging Flags</caption> + * <tr> + * <td> + * #H5FD_LOG_LOC_READ + * </td> + * <td rowspan="3"> + * Track the location and length of every read, write, or seek operation. + * </td> + * </tr> + * <tr><td>#H5FD_LOG_LOC_WRITE</td></tr> + * <tr><td>#H5FD_LOG_LOC_SEEK</td></tr> + * <tr> + * <td> + * #H5FD_LOG_LOC_IO + * </td> + * <td> + * Track all I/O locations and lengths. The logical equivalent of the following: + * \Code{(#H5FD_LOG_LOC_READ | #H5FD_LOG_LOC_WRITE | #H5FD_LOG_LOC_SEEK)} + * </td> + * </tr> + * <tr> + * <td> + * #H5FD_LOG_FILE_READ + * </td> + * <td rowspan="2"> + * Track the number of times each byte is read or written. + * </td> + * </tr> + * <tr><td>#H5FD_LOG_FILE_WRITE</td></tr> + * <tr> + * <td> + * #H5FD_LOG_FILE_IO + * </td> + * <td> + * Track the number of times each byte is read and written. The logical + * equivalent of the following: + * \Code{(#H5FD_LOG_FILE_READ | #H5FD_LOG_FILE_WRITE)} + * </td> + * </tr> + * <tr> + * <td> + * #H5FD_LOG_FLAVOR + * </td> + * <td> + * Track the type, or flavor, of information stored at each byte. + * </td> + * </tr> + * <tr> + * <td> + * #H5FD_LOG_NUM_READ + * </td> + * <td rowspan="4"> + * Track the total number of read, write, seek, or truncate operations that occur. + * </td> + * </tr> + * <tr><td>#H5FD_LOG_NUM_WRITE</td></tr> + * <tr><td>#H5FD_LOG_NUM_SEEK</td></tr> + * <tr><td>#H5FD_LOG_NUM_TRUNCATE</td></tr> + * <tr> + * <td> + * #H5FD_LOG_NUM_IO + * </td> + * <td> + * Track the total number of all types of I/O operations. The logical equivalent + * of the following: + * \Code{(#H5FD_LOG_NUM_READ | #H5FD_LOG_NUM_WRITE | #H5FD_LOG_NUM_SEEK | #H5FD_LOG_NUM_TRUNCATE)} + * </td> + * </tr> + * <tr> + * <td> + * #H5FD_LOG_TIME_OPEN + * </td> + * <td rowspan="6"> + * Track the time spent in open, stat, read, write, seek, or close operations. + * </td> + * </tr> + * <tr><td>#H5FD_LOG_TIME_STAT</td></tr> + * <tr><td>#H5FD_LOG_TIME_READ</td></tr> + * <tr><td>#H5FD_LOG_TIME_WRITE</td></tr> + * <tr><td>#H5FD_LOG_TIME_SEEK</td></tr> + * <tr><td>#H5FD_LOG_TIME_CLOSE</td></tr> + * <tr> + * <td> + * #H5FD_LOG_TIME_IO + * </td> + * <td> + * Track the time spent in each of the above operations. The logical equivalent + * of the following: + * \Code{(#H5FD_LOG_TIME_OPEN | #H5FD_LOG_TIME_STAT | #H5FD_LOG_TIME_READ | #H5FD_LOG_TIME_WRITE | + * #H5FD_LOG_TIME_SEEK | #H5FD_LOG_TIME_CLOSE)} + * </td> + * </tr> + * <tr> + * <td> + * #H5FD_LOG_ALLOC + * </td> + * <td> + * Track the allocation of space in the file. + * </td> + * </tr> + * <tr> + * <td> + * #H5FD_LOG_ALL + * </td> + * <td> + * Track everything. The logical equivalent of the following: + * \Code{(#H5FD_LOG_ALLOC | #H5FD_LOG_TIME_IO | #H5FD_LOG_NUM_IO | #H5FD_LOG_FLAVOR | #H5FD_LOG_FILE_IO | + * #H5FD_LOG_LOC_IO)} + * </td> + * </tr> + * </table> + * The logging driver can track the number of times each byte in the file is + * read from or written to (using #H5FD_LOG_FILE_READ and #H5FD_LOG_FILE_WRITE) + * and what kind of data is at that location (e.g., metadata, raw data; using + * #H5FD_LOG_FLAVOR). This information is tracked in internal buffers of size + * buf_size, which must be at least the maximum size in bytes of the file to be + * logged while the log driver is in use.\n + * One buffer of size buf_size will be created for each of #H5FD_LOG_FILE_READ, + * #H5FD_LOG_FILE_WRITE and #H5FD_LOG_FLAVOR when those flags are set; these + * buffers will not grow as the file increases in size. + * + * \par Output: + * This section describes the logging driver (LOG VFD) output.\n + * The table, immediately below, describes output of the various logging driver + * flags and function calls. A list of valid flavor values, describing the type + * of data stored, follows the table. + * <table> + * <caption>Table2: Logging Output</caption> + * <tr> + * <th>Flag</th><th>VFD Call</th><th>Output and Comments</th> + * </th> + * </tr> + * <tr> + * <td>#H5FD_LOG_LOC_READ</td> + * <td>Read</td> + * <td> + * \Code{%10a-%10a (%10Zu bytes) (%s) Read}\n\n + * Start position\n + * End position\n + * Number of bytes\n + * Flavor of read\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_LOC_READ</td> + * <td>Read Error</td> + * <td> + * \Code{Error! Reading: %10a-%10a (%10Zu bytes)}\n\n + * Same parameters as non-error entry. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_LOC_WRITE</td> + * <td>Write</td> + * <td> + * \Code{%10a-%10a (%10Zu bytes) (%s) Written}\n\n + * Start position\n + * End position\n + * Number of bytes\n + * Flavor of write\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_LOC_WRITE</td> + * <td>Write Error</td> + * <td> + * \Code{Error! Writing: %10a-%10a (%10Zu bytes)}\n\n + * Same parameters as non-error entry. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_LOC_SEEK</td> + * <td>Read, Write</td> + * <td> + * \Code{Seek: From %10a-%10a}\n\n + * Start position\n + * End position\n\n + * Adds \Code{(\%f s)} and seek time if #H5FD_LOG_TIME_SEEK is also set. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_FILE_READ</td> + * <td>Close</td> + * <td> + * Begins with:\n + * Dumping read I/O information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) read from %3d times}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Number of times read\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_FILE_WRITE</td> + * <td>Close</td> + * <td> + * Begins with:\n + * Dumping read I/O information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) written to %3d times}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Number of times written\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_FLAVOR</td> + * <td>Close</td> + * <td> + * Begins with:\n + * Dumping I/O flavor information\n\n + * Then, for each range of identical values, there is this line:\n + * \Code{Addr %10-%10 (%10lu bytes) flavor is %s}\n\n + * Start address\n + * End address\n + * Number of bytes\n + * Flavor\n\n + * Note: The data buffer is scanned and each range of identical values + * gets one entry in the log file to save space and make it easier to read. + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_NUM_READ</td> + * <td>Close</td> + * <td> + * Total number of read operations: \Code{%11u} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_NUM_WRITE</td> + * <td>Close</td> + * <td> + * Total number of write operations: \Code{%11u} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_NUM_SEEK</td> + * <td>Close</td> + * <td> + * Total number of seek operations: \Code{%11u} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_NUM_TRUNCATE</td> + * <td>Close</td> + * <td> + * Total number of truncate operations: \Code{%11u} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_TIME_OPEN</td> + * <td>Open</td> + * <td> + * Open took: \Code{(\%f s)} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_TIME_READ</td> + * <td>Close, Read</td> + * <td> + * Total time in read operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_READ + * </td> + * </tr> + * </tr> + * <tr> + * <td>#H5FD_LOG_TIME_WRITE</td> + * <td>Close, Write</td> + * <td> + * Total time in write operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_WRITE + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_TIME_SEEK</td> + * <td>Close, Read, Write</td> + * <td> + * Total time in write operations: \Code{\%f s}\n\n + * See also: #H5FD_LOG_LOC_SEEK or #H5FD_LOG_LOC_WRITE + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_TIME_CLOSE</td> + * <td>Close</td> + * <td> + * Close took: \Code{(\%f s)} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_TIME_STAT</td> + * <td>Open</td> + * <td> + * Stat took: \Code{(\%f s)} + * </td> + * </tr> + * <tr> + * <td>#H5FD_LOG_ALLOC</td> + * <td>Alloc</td> + * <td> + * \Code{%10-%10 (%10Hu bytes) (\%s) Allocated}\n\n + * Start of address space\n + * End of address space\n + * Total size allocation\n + * Flavor of allocation + * </td> + * </tr> + * </table> + * + * \par Flavors: + * The \Emph{flavor} describes the type of stored information. The following + * table lists the flavors that appear in log output and briefly describes each. + * These terms are provided here to aid in the construction of log message + * parsers; a full description is beyond the scope of this document. + * <table> + * <caption>Table3: Flavors of logged data</caption> + * <tr> + * <th>Flavor</th><th>Description</th> + * </th> + * </tr> + * <tr> + * <td>#H5FD_MEM_NOLIST</td> + * <td>Error value</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_DEFAULT</td> + * <td>Value not yet set.\n + * May also be a datatype set in a larger allocation that will be + * suballocated by the library.</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_SUPER</td> + * <td>Superblock data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_BTREE</td> + * <td>B-tree data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_DRAW</td> + * <td>Raw data (for example, contents of a dataset)</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_GHEAP</td> + * <td>Global heap data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_LHEAP</td> + * <td>Local heap data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_OHDR</td> + * <td>Object header data</td> + * </tr> + * </table> + * + * \version 1.8.7 The flags parameter has been changed from \Code{unsigned int} + * to \Code{unsigned long long}. + * The implementation of the #H5FD_LOG_TIME_OPEN, #H5FD_LOG_TIME_READ, + * #H5FD_LOG_TIME_WRITE, and #H5FD_LOG_TIME_SEEK flags has been finished. + * New flags were added: #H5FD_LOG_NUM_TRUNCATE and #H5FD_LOG_TIME_STAT. + * \version 1.6.0 The \c verbosity parameter has been removed. + * Two new parameters have been added: \p flags of type \Code{unsigned} and + * \p buf_size of type \Code{size_t}. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, size_t buf_size); #ifdef __cplusplus diff --git a/src/H5FDmirror.h b/src/H5FDmirror.h index 8aef934..49e24c1 100644 --- a/src/H5FDmirror.h +++ b/src/H5FDmirror.h @@ -61,8 +61,20 @@ typedef struct H5FD_mirror_fapl_t { char remote_ip[H5FD_MIRROR_MAX_IP_LEN + 1]; } H5FD_mirror_fapl_t; -H5_DLL hid_t H5FD_mirror_init(void); +H5_DLL hid_t H5FD_mirror_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_out); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa); #ifdef __cplusplus diff --git a/src/H5FDmpi.h b/src/H5FDmpi.h index 3af5e41..cf49301 100644 --- a/src/H5FDmpi.h +++ b/src/H5FDmpi.h @@ -34,10 +34,12 @@ */ #define H5D_MULTI_CHUNK_IO_COL_THRESHOLD 60 -/* Type of I/O for data transfer properties */ +/** + * Type of I/O for data transfer properties + */ typedef enum H5FD_mpio_xfer_t { - H5FD_MPIO_INDEPENDENT = 0, /*zero is the default*/ - H5FD_MPIO_COLLECTIVE + H5FD_MPIO_INDEPENDENT = 0, /**< Use independent I/O access */ + H5FD_MPIO_COLLECTIVE /**< Use collective I/O access */ } H5FD_mpio_xfer_t; /* Type of chunked dataset I/O */ diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h index 79b52c7..8caf11c 100644 --- a/src/H5FDmpio.h +++ b/src/H5FDmpio.h @@ -44,14 +44,237 @@ H5_DLLVAR hbool_t H5FD_mpi_opt_types_g; #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_mpio_init(void); +H5_DLL hid_t H5FD_mpio_init(void); + +/** + * \ingroup FAPL + * + * \brief Stores MPI IO communicator information to the file access property list + * + * \fapl_id + * \param[in] comm MPI-2 communicator + * \param[in] info MPI-2 info object + * \returns \herr_t + * + * \details H5Pset_fapl_mpio() stores the user-supplied MPI IO parameters \p + * comm, for communicator, and \p info, for information, in the file + * access property list \p fapl_id. That property list can then be used + * to create and/or open a file. + * + * H5Pset_fapl_mpio() is available only in the parallel HDF5 library + * and is not a collective function. + * + * \p comm is the MPI communicator to be used for file open, as defined + * in \c MPI_File_open of MPI-2. This function makes a duplicate of the + * communicator, so modifications to \p comm after this function call + * returns have no effect on the file access property list. + * + * \p info is the MPI Info object to be used for file open, as defined + * in MPI_File_open() of MPI-2. This function makes a duplicate copy of + * the Info object, so modifications to the Info object after this + * function call returns will have no effect on the file access + * property list. + * + * If the file access property list already contains previously-set + * communicator and Info values, those values will be replaced and the + * old communicator and Info object will be freed. + * + * \note Raw dataset chunk caching is not currently supported when using this + * file driver in read/write mode. All calls to H5Dread() and H5Dwrite() + * will access the disk directly, and H5Pset_cache() and + * H5Pset_chunk_cache() will have no effect on performance.\n + * Raw dataset chunk caching is supported when this driver is used in + * read-only mode. + * + * \version 1.4.5 Handling of the MPI Communicator and Info object changed at + * this release. A duplicate of each of these is now stored in the property + * list instead of pointers to each. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info); + +/** + * \ingroup FAPL + * + * \brief Returns MPI IO communicator information + * + * \fapl_id + * \param[out] comm MPI-2 communicator + * \param[out] info MPI-2 info object + * \returns \herr_t + * + * \details If the file access property list is set to the #H5FD_MPIO driver, + * H5Pget_fapl_mpio() returns duplicates of the stored MPI communicator + * and Info object through the \p comm and \p info pointers, if those + * values are non-null. + * + * Since the MPI communicator and Info object are duplicates of the + * stored information, future modifications to the access property list + * will not affect them. It is the responsibility of the application to + * free these objects. + * + * \version 1.4.5 Handling of the MPI Communicator and Info object changed at + * this release. A duplicate of each of these is now stored in the + * property list instead of pointers to each. + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/); + +/** + * \ingroup DXPL + * + * \brief Sets data transfer mode + * + * \dxpl_id + * \param[in] xfer_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id + * to use transfer mode \p xfer_mode. The property list can then be + * used to control the I/O transfer mode during data I/O operations. + * + * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and + * #H5FD_MPIO_COLLECTIVE. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode); + +/** + * \ingroup DXPL + * + * \brief Returns the data transfer mode + * + * \dxpl_id + * \param[out] xfer_mode Transfer mode + * \returns \herr_t + * + * \details H5Pget_dxpl_mpio() queries the data transfer mode currently set in + * the data transfer property list \p dxpl_id. + * + * Upon return, \p xfer_mode contains the data transfer mode, if it is + * non-null. + * + * H5Pget_dxpl_mpio() is not a collective function. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/); + +/** + * \ingroup DXPL + * + * \brief Sets data transfer mode + * + * \dxpl_id + * \param[in] opt_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id + * to use transfer mode xfer_mode. The property list can then be used + * to control the I/O transfer mode during data I/O operations. + * + * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and + * #H5FD_MPIO_COLLECTIVE. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode); + +/** + * \ingroup DXPL + * + * \brief Sets a flag specifying linked-chunk I/O or multi-chunk I/O + * + * \dxpl_id + * \param[in] opt_mode Transfer mode + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt() specifies whether I/O is to be + * performed as linked-chunk I/O or as multi-chunk I/O. This function + * overrides the HDF5 library's internal algorithm for determining + * which mechanism to use. + * + * When an application uses collective I/O with chunked storage, the + * HDF5 library normally uses an internal algorithm to determine + * whether that I/O activity should be conducted as one linked-chunk + * I/O or as multi-chunk I/O. H5Pset_dxpl_mpio_chunk_opt() is provided + * so that an application can override the library's algorithm in + * circumstances where the library might lack the information needed to + * make an optimal decision. + * + * H5Pset_dxpl_mpio_chunk_opt() works by setting one of the following + * flags in the parameter \p opt_mode: + * - #H5FD_MPIO_CHUNK_ONE_IO - Do one-link chunked I/O + * - #H5FD_MPIO_CHUNK_MULTI_IO - Do multi-chunked I/O + * + * This function works by setting a corresponding property in the + * dataset transfer property list \p dxpl_id. + * + * The library performs I/O in the specified manner unless it + * determines that the low-level MPI IO package does not support the + * requested behavior; in such cases, the HDF5 library will internally + * use independent I/O. + * + * Use of this function is optional. + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode); + +/** + * \ingroup DXPL + * + * \brief Sets a numeric threshold for linked-chunk I/O + * + * \dxpl_id + * \param[in] num_chunk_per_proc + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt_num() sets a numeric threshold for the + * use of linked-chunk I/O. + * + * The library will calculate the average number of chunks selected by + * each process when doing collective access with chunked storage. If + * the number is greater than the threshold set in \p + * num_chunk_per_proc, the library will use linked-chunk I/O; + * otherwise, a separate I/O process will be invoked for each chunk + * (multi-chunk I/O). + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc); + +/** + * \ingroup DXPL + * + * \brief Sets a ratio threshold for collective I/O + * + * \dxpl_id + * \param[in] percent_num_proc_per_chunk + * \returns \herr_t + * + * \details H5Pset_dxpl_mpio_chunk_opt_ratio() sets a threshold for the use of + * collective I/O based on the ratio of processes with collective + * access to a dataset with chunked storage. The decision whether to + * use collective I/O is made on a per-chunk basis. + * + * The library will calculate the percentage of the total number of + * processes, the ratio, that hold selections in each chunk. If that + * percentage is greater than the threshold set in \p + * percent_proc_per_chunk, the library will do collective I/O for this + * chunk; otherwise, independent I/O will be done for the chunk. + * + * \todo Add missing version information + * + */ H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk); #ifdef __cplusplus } diff --git a/src/H5FDmulti.h b/src/H5FDmulti.h index 9e04d8d..62cc9c8 100644 --- a/src/H5FDmulti.h +++ b/src/H5FDmulti.h @@ -25,11 +25,228 @@ #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_multi_init(void); +H5_DLL hid_t H5FD_multi_init(void); + +/** + * \ingroup FAPL + * + * \brief Sets up use of the multi-file driver + * + * \fapl_id + * \param[in] memb_map Maps memory usage types to other memory usage types + * \param[in] memb_fapl Property list for each memory usage type + * \param[in] memb_name Name generator for names of member files + * \param[in] memb_addr The offsets within the virtual address space, from 0 + * (zero) to #HADDR_MAX, at which each type of data storage begins + * \param[in] relax Allows read-only access to incomplete file sets when \c TRUE + * \returns \herr_t + * + * \details H5Pset_fapl_multi() sets the file access property list \p fapl_id to + * use the multi-file driver. + * + * The multi-file driver enables different types of HDF5 data and + * metadata to be written to separate files. These files are viewed by + * the HDF5 library and the application as a single virtual HDF5 file + * with a single HDF5 file address space. The types of data that can be + * broken out into separate files include raw data, the superblock, + * B-tree data, global heap data, local heap data, and object + * headers. At the programmer's discretion, two or more types of data + * can be written to the same file while other types of data are + * written to separate files. + * + * The array \p memb_map maps memory usage types to other memory usage + * types and is the mechanism that allows the caller to specify how + * many files are created. The array contains #H5FD_MEM_NTYPES entries, + * which are either the value #H5FD_MEM_DEFAULT or a memory usage + * type. The number of unique values determines the number of files + * that are opened. + * + * The array \p memb_fapl contains a property list for each memory + * usage type that will be associated with a file. + * + * The array \p memb_name should be a name generator (a + * \Code{printf}-style format with a \Code{%s} which will be replaced + * with the name passed to H5FDopen(), usually from H5Fcreate() or + * H5Fopen()). + * + * The array \p memb_addr specifies the offsets within the virtual + * address space, from 0 (zero) to #HADDR_MAX, at which each type of + * data storage begins. + * + * If \p relax is set to 1 (TRUE), then opening an existing file for + * read-only access will not fail if some file members are + * missing. This allows a file to be accessed in a limited sense if + * just the meta data is available. + * + * Default values for each of the optional arguments are as follows: + * <table> + * <tr> + * <td>\p memb_map</td> + * <td>The default member map contains the value #H5FD_MEM_DEFAULT for each element.</td> + * </tr> + * <tr> + * <td> + * \p memb_fapl + * </td> + * <td> + * The default value is #H5P_DEFAULT for each element. + * </td> + * </tr> + * <tr> + * <td> + * \p memb_name + * </td> + * <td> + * The default string is \Code{%s-X.h5} where \c X is one of the following letters: + * - \c s for #H5FD_MEM_SUPER + * - \c b for #H5FD_MEM_BTREE + * - \c r for #H5FD_MEM_DRAW + * - \c g for #H5FD_MEM_GHEAP + * - \c l for #H5FD_MEM_LHEAP + * - \c o for #H5FD_MEM_OHDR + * </td> + * </tr> + * <tr> + * <td> + * \p memb_addr + * </td> + * <td> + * The default setting is that the address space is equally divided + * among all of the elements: + * - #H5FD_MEM_SUPER \Code{-> 0 * (HADDR_MAX/6)} + * - #H5FD_MEM_BTREE \Code{-> 1 * (HADDR_MAX/6)} + * - #H5FD_MEM_DRAW \Code{-> 2 * (HADDR_MAX/6)} + * - #H5FD_MEM_GHEAP \Code{-> 3 * (HADDR_MAX/6)} + * - #H5FD_MEM_LHEAP \Code{-> 4 * (HADDR_MAX/6)} + * - #H5FD_MEM_OHDR \Code{-> 5 * (HADDR_MAX/6)} + * </td> + * </tr> + * </table> + * + * \par Example: + * The following code sample sets up a multi-file access property list that + * partitions data into meta and raw files, each being one-half of the address:\n + * \code + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * hid_t memb_fapl[H5FD_MEM_NTYPES]; + * const char *memb[H5FD_MEM_NTYPES]; + * haddr_t memb_addr[H5FD_MEM_NTYPES]; + * + * // The mapping... + * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) { + * memb_map[mt] = H5FD_MEM_SUPER; + * } + * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; + * + * // Member information + * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; + * memb_name[H5FD_MEM_SUPER] = "%s.meta"; + * memb_addr[H5FD_MEM_SUPER] = 0; + * + * memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT; + * memb_name[H5FD_MEM_DRAW] = "%s.raw"; + * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; + * + * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); + * H5Pset_fapl_multi(fapl, memb_map, memb_fapl, + * memb_name, memb_addr, TRUE); + * \endcode + * + * \version 1.6.3 \p memb_name parameter type changed to \Code{const char* const*}. + * \since 1.4.0 + */ H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl, const char *const *memb_name, const haddr_t *memb_addr, hbool_t relax); + +/** + * \ingroup FAPL + * + * \brief Returns information about the multi-file access property list + * + * \fapl_id + * \param[out] memb_map Maps memory usage types to other memory usage types + * \param[out] memb_fapl Property list for each memory usage type + * \param[out] memb_name Name generator for names of member files + * \param[out] memb_addr The offsets within the virtual address space, from 0 + * (zero) to #HADDR_MAX, at which each type of data storage begins + * \param[out] relax Allows read-only access to incomplete file sets when \c TRUE + * \returns \herr_t + * + * \details H5Pget_fapl_multi() returns information about the multi-file access + * property list. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl /*out*/, char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax /*out*/); + +/** + * \ingroup FAPL + * + * \brief Emulates the old split file driver + * + * \fapl_id{fapl} + * \param[in] meta_ext Metadata filename extension + * \param[in] meta_plist_id File access property list identifier for the metadata file + * \param[in] raw_ext Raw data filename extension + * \param[in] raw_plist_id + * \returns \herr_t + * + * \details H5Pset_fapl_split() is a compatibility function that enables the + * multi-file driver to emulate the split driver from HDF5 Releases 1.0 + * and 1.2. The split file driver stored metadata and raw data in + * separate files but provided no mechanism for separating types of + * metadata. + * + * \p fapl is a file access property list identifier. + * + * \p meta_ext is the filename extension for the metadata file. The + * extension is appended to the name passed to H5FDopen(), usually from + * H5Fcreate() or H5Fopen(), to form the name of the metadata file. If + * the string \Code{%s} is used in the extension, it works like the + * name generator as in H5Pset_fapl_multi(). + * + * \p meta_plist_id is the file access property list identifier for the + * metadata file. + * + * \p raw_ext is the filename extension for the raw data file. The + * extension is appended to the name passed to H5FDopen(), usually from + * H5Fcreate() or H5Fopen(), to form the name of the raw data file. If + * the string \Code{%s} is used in the extension, it works like the + * name generator as in H5Pset_fapl_multi(). + * + * \p raw_plist_id is the file access property list identifier for the + * raw data file. + * + * If a user wishes to check to see whether this driver is in use, the + * user must call H5Pget_driver() and compare the returned value to the + * string #H5FD_MULTI. A positive match will confirm that the multi + * driver is in use; HDF5 provides no mechanism to determine whether it + * was called as the special case invoked by H5Pset_fapl_split(). + * + * \par Example: + * \code + * // Example 1: Both metadata and rawdata files are in the same + * // directory. Use Station1-m.h5 and Station1-r.h5 as + * // the metadata and rawdata files. + * hid_t fapl, fid; + * fapl = H5Pcreate(H5P_FILE_ACCESS); + * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT); + * fid=H5Fcreate("Station1",H5F_ACC_TRUNC,H5P_DEFAULT,fapl); + * + * // Example 2: metadata and rawdata files are in different + * // directories. Use PointA-m.h5 and /pfs/PointA-r.h5 as + * // the metadata and rawdata files. + * hid_t fapl, fid; + * fapl = H5Pcreate(H5P_FILE_ACCESS); + * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "/pfs/%s-r.h5", H5P_DEFAULT); + * fid=H5Fcreate("PointA",H5F_ACC_TRUNC,H5P_DEFAULT,fapl); + * \endcode + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext, hid_t raw_plist_id); #ifdef __cplusplus diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index edcea52..36f37f0 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -328,29 +328,113 @@ struct H5FD_t { hbool_t paged_aggr; /* Paged aggregation for file space is enabled or not */ }; -/* Define enum for the source of file image callbacks */ +/** + * Define enum for the source of file image callbacks + */ +//! <!-- [H5FD_file_image_op_t_snip] --> typedef enum { H5FD_FILE_IMAGE_OP_NO_OP, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, + /**< Passed to the \p image_malloc and \p image_memcpy callbacks when a + * file image buffer is to be copied while being set in a file access + * property list (FAPL)*/ H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, + /**< Passed to the \p image_malloc and \p image_memcpy callbacks + * when a file image buffer is to be copied when a FAPL is copied*/ H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, + /**<Passed to the \p image_malloc and \p image_memcpy callbacks when + * a file image buffer is to be copied while being retrieved from a FAPL*/ H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, + /**<Passed to the \p image_free callback when a file image + * buffer is to be released during a FAPL close operation*/ H5FD_FILE_IMAGE_OP_FILE_OPEN, + /**<Passed to the \p image_malloc and + * \p image_memcpy callbackswhen a + * file image buffer is to be copied during a file open operation \n + * While the file image being opened will typically be copied from a + * FAPL, this need not always be the case. For example, the core file + * driver, also known as the memory file driver, takes its initial + * image from a file.*/ H5FD_FILE_IMAGE_OP_FILE_RESIZE, + /**<Passed to the \p image_realloc callback when a file driver needs + * to resize an image buffer*/ H5FD_FILE_IMAGE_OP_FILE_CLOSE + /**<Passed to the \p image_free callback when an image buffer is to + * be released during a file close operation*/ } H5FD_file_image_op_t; +//! <!-- [H5FD_file_image_op_t_snip] --> -/* Define structure to hold file image callbacks */ +/** + * Define structure to hold file image callbacks + */ +//! <!-- [H5FD_file_image_callbacks_t_snip] --> typedef struct { + /** + * \param[in] size Size in bytes of the file image buffer to allocate + * \param[in] file_image_op A value from H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! <!-- [image_malloc_snip] --> void *(*image_malloc)(size_t size, H5FD_file_image_op_t file_image_op, void *udata); + //! <!-- [image_malloc_snip] --> + /** + * \param[in] dest Address of the destination buffer + * \param[in] src Address of the source buffer + * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! <!-- [image_memcpy_snip] --> void *(*image_memcpy)(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, void *udata); + //! <!-- [image_memcpy_snip] --> + /** + * \param[in] ptr Pointer to the buffer being reallocated + * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! <!-- [image_realloc_snip] --> void *(*image_realloc)(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata); + //! <!-- [image_realloc_snip] --> + /** + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! <!-- [image_free_snip] --> herr_t (*image_free)(void *ptr, H5FD_file_image_op_t file_image_op, void *udata); + //! <!-- [image_free_snip] --> + /** + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! <!-- [udata_copy_snip] --> void *(*udata_copy)(void *udata); + //! <!-- [udata_copy_snip] --> + /** + * \param[in] udata Value passed in in the H5Pset_file_image_callbacks + * parameter \p udata + */ + //! <!-- [udata_free_snip] --> herr_t (*udata_free)(void *udata); + //! <!-- [udata_free_snip] --> + /** + * \brief The final field in the #H5FD_file_image_callbacks_t struct, + * provides a pointer to user-defined data. This pointer will be + * passed to the image_malloc, image_memcpy, image_realloc, and + * image_free callbacks. Define udata as NULL if no user-defined + * data is provided. + */ void *udata; } H5FD_file_image_callbacks_t; +//! <!-- [H5FD_file_image_callbacks_t_snip] --> #ifdef __cplusplus extern "C" { diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 3ef6b8a..8e42ca2 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -89,8 +89,20 @@ typedef struct H5FD_ros3_fapl_t { extern "C" { #endif -H5_DLL hid_t H5FD_ros3_init(void); +H5_DLL hid_t H5FD_ros3_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa); #ifdef __cplusplus diff --git a/src/H5FDsplitter.h b/src/H5FDsplitter.h index a201116..ee6e7c5 100644 --- a/src/H5FDsplitter.h +++ b/src/H5FDsplitter.h @@ -87,8 +87,20 @@ typedef struct H5FD_splitter_vfd_config_t { #ifdef __cplusplus extern "C" { #endif -H5_DLL hid_t H5FD_splitter_init(void); +H5_DLL hid_t H5FD_splitter_init(void); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_ptr); + +/** + * \ingroup FAPL + * + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config_ptr); #ifdef __cplusplus diff --git a/src/H5FDstdio.h b/src/H5FDstdio.h index b3e06bb..9db92ed 100644 --- a/src/H5FDstdio.h +++ b/src/H5FDstdio.h @@ -28,7 +28,21 @@ extern "C" { #endif -H5_DLL hid_t H5FD_stdio_init(void); +H5_DLL hid_t H5FD_stdio_init(void); +/** + * \ingroup FAPL + * + * \brief Sets the standard I/O driver + * + * \fapl_id + * \returns \herr_t + * + * \details H5Pset_fapl_stdio() modifies the file access property list to use + * the standard I/O driver, H5FDstdio(). + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Pset_fapl_stdio(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5FDwindows.h b/src/H5FDwindows.h index c1c4654..79e73b6 100644 --- a/src/H5FDwindows.h +++ b/src/H5FDwindows.h @@ -27,6 +27,36 @@ extern "C" { #endif /* __cplusplus */ +/** + * \ingroup FAPL + * + * \brief Sets the Windows I/O driver + * + * \fapl_id + * \returns \herr_t + * + * \details H5Pset_fapl_windows() sets the default HDF5 Windows I/O driver on + * Windows systems. + * + * Since the HDF5 library uses this driver, #H5FD_WINDOWS, by default + * on Windows systems, it is not normally necessary for a user + * application to call H5Pset_fapl_windows(). While it is not + * recommended, there may be times when a user chooses to set a + * different HDF5 driver, such as the standard I/O driver (#H5FD_STDIO) + * or the sec2 driver (#H5FD_SEC2), in a Windows + * application. H5Pset_fapl_windows() is provided so that the + * application can return to the Windows I/O driver when the time + * comes. + * + * Only the Windows driver is tested on Windows systems; other drivers + * are used at the application’s and the user’s risk. + * + * Furthermore, the Windows driver is tested and available only on + * Windows systems; it is not available on non-Windows systems. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_fapl_windows(hid_t fapl_id); #ifdef __cplusplus diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h index 33c302a..7f0299a 100644 --- a/src/H5Fmodule.h +++ b/src/H5Fmodule.h @@ -31,8 +31,34 @@ /** * \defgroup H5F H5F - * \brief File Interface - * \todo Describe concisely what the functions in this module are about. + * + * Use the functions in this module to manage HDF5 files. + * + * In the code snippets below, we show the skeletal life cycle of an HDF5 file, + * when creating a new file (left) or when opening an existing file (right). + * File creation is essentially controlled through \ref FCPL, and file access to + * new and existing files is controlled through \ref FAPL. The file \c name and + * creation or access \c mode control the interaction with the underlying + * storage such as file systems. + * + * \Emph{Proper error handling is part of the life cycle.} + * <table> + * <tr><th>Create</th><th>Open</th></tr> + * <tr valign="top"> + * <td> + * \snippet H5F_examples.c life_cycle + * </td> + * <td> + * \snippet H5F_examples.c life_cycle_w_open + * </td> + * </tr> + * </table> + * + * In addition to general file management functions, there are three categories + * of functions that deal with advanced file management tasks and use cases: + * 1. The control of the HDF5 \ref MDC + * 2. The use of (MPI-) \ref PH5F HDF5 + * 3. The \ref SWMR pattern * * \defgroup MDC Metadata Cache * \ingroup H5F diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index c410beb..89238b6 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -47,27 +47,23 @@ * We're assuming that these constants are used rather early in the hdf5 * session. */ -#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /**< Absence of RDWR: read-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /**< Open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /**< Overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /**< Fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< create non-existing files */ +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /**< Create non-existing files */ #define H5F_ACC_SWMR_WRITE \ - (H5CHECK 0x0020u) /**< indicate that this file is open for writing in a \ - single-writer/multi-reader (SWMR) scenario. \ - Note that the process(es) opening the file for reading must \ - open the file with RDONLY access, and use the special "SWMR_READ" \ - access flag. */ + (H5CHECK 0x0020u) /**< Indicate that this file is open for writing in a \ + * single-writer/multi-reader (SWMR) scenario. \ + * Note that the process(es) opening the file for reading \ + * must open the file with #H5F_ACC_RDONLY and use the \ + * #H5F_ACC_SWMR_READ access flag. */ #define H5F_ACC_SWMR_READ \ - (H5CHECK 0x0040u) /**< indicate that this file is \ - * open for reading in a \ - * single-writer/multi-reader (SWMR) \ - * scenario. Note that the \ - * process(es) opening the file \ - * for SWMR reading must also \ - * open the file with the RDONLY \ - * flag. */ + (H5CHECK 0x0040u) /**< Indicate that this file is open for reading in a \ + * single-writer/multi-reader (SWMR) scenario. Note that \ + * the process(es) opening the file for SWMR reading must \ + * also open the file with the #H5F_ACC_RDONLY flag. */ /** * Default property list identifier @@ -91,7 +87,7 @@ #define H5F_FAMILY_DEFAULT (hsize_t)0 #ifdef H5_HAVE_PARALLEL -/* +/** * Use this constant string as the MPI_Info key to set H5Fmpio debug flags. * To turn on H5Fmpio debug flags, set the MPI_Info value with this key to * have the value of a string consisting of the characters that turn on the @@ -101,11 +97,12 @@ #endif /* H5_HAVE_PARALLEL */ /** - * The difference between a single file and a set of mounted files + * The scope of an operation such as H5Fflush(), e.g., + * a single file vs. a set of mounted files */ typedef enum H5F_scope_t { - H5F_SCOPE_LOCAL = 0, /**< specified file handle only */ - H5F_SCOPE_GLOBAL = 1 /**< entire virtual file */ + H5F_SCOPE_LOCAL = 0, /**< The specified file handle only */ + H5F_SCOPE_GLOBAL = 1 /**< The entire virtual file */ } H5F_scope_t; /** @@ -117,16 +114,16 @@ typedef enum H5F_scope_t { * How does file close behave? */ typedef enum H5F_close_degree_t { - H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlining VFL */ + H5F_CLOSE_DEFAULT = 0, /**< Use the degree pre-defined by underlying VFD */ H5F_CLOSE_WEAK = 1, /**< File closes only after all opened objects are closed */ - H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is close; otherwise, file close fails */ + H5F_CLOSE_SEMI = 2, /**< If no opened objects, file is closed; otherwise, file close fails */ H5F_CLOSE_STRONG = 3 /**< If there are opened objects, close them first, then close file */ } H5F_close_degree_t; /** * Current "global" information about file */ -//! [H5F_info2_t_snip] +//! <!-- [H5F_info2_t_snip] --> typedef struct H5F_info2_t { struct { unsigned version; /**< Superblock version # */ @@ -144,7 +141,7 @@ typedef struct H5F_info2_t { H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ } sohm; } H5F_info2_t; -//! [H5F_info2_t_snip] +//! <!-- [H5F_info2_t_snip] --> /** * Types of allocation requests. The values larger than #H5FD_MEM_DEFAULT @@ -176,12 +173,12 @@ typedef enum H5F_mem_t { /** * Free space section information */ -//! [H5F_sect_info_t_snip] +//! <!-- [H5F_sect_info_t_snip] --> typedef struct H5F_sect_info_t { haddr_t addr; /**< Address of free space section */ hsize_t size; /**< Size of free space section */ } H5F_sect_info_t; -//! [H5F_sect_info_t_snip] +//! <!-- [H5F_sect_info_t_snip] --> /** * Library's format versions @@ -200,6 +197,7 @@ typedef enum H5F_libver_t { /** * File space handling strategy */ +//! <!-- [H5F_fspace_strategy_t_snip] --> typedef enum H5F_fspace_strategy_t { H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /**< Mechanisms: free-space managers, aggregators, and virtual file drivers This is the library default when not set */ @@ -209,6 +207,7 @@ typedef enum H5F_fspace_strategy_t { H5F_FSPACE_STRATEGY_NONE = 3, /**< Mechanisms: virtual file drivers */ H5F_FSPACE_STRATEGY_NTYPES /**< Sentinel */ } H5F_fspace_strategy_t; +//! <!-- [H5F_fspace_strategy_t_snip] --> /** * File space handling strategy for release 1.10.0 @@ -225,7 +224,7 @@ typedef enum H5F_file_space_type_t { H5F_FILE_SPACE_NTYPES /**< Sentinel */ } H5F_file_space_type_t; -//! [H5F_retry_info_t_snip] +//! <!-- [H5F_retry_info_t_snip] --> #define H5F_NUM_METADATA_READ_RETRY_TYPES 21 /** @@ -236,7 +235,7 @@ typedef struct H5F_retry_info_t { unsigned nbins; uint32_t *retries[H5F_NUM_METADATA_READ_RETRY_TYPES]; } H5F_retry_info_t; -//! [H5F_retry_info_t_snip] +//! <!-- [H5F_retry_info_t_snip] --> /** * Callback for H5Pset_object_flush_cb() in a file access property list @@ -274,11 +273,6 @@ extern "C" { */ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); /** - * \example H5Fcreate.c - * After creating an HDF5 file with H5Fcreate(), we close it with - * H5Fclose(). - */ -/** * \ingroup H5F * * \brief Creates an HDF5 file @@ -318,7 +312,8 @@ H5_DLL htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id); * this file identifier should be closed by calling H5Fclose() when * it is no longer needed. * - * \include H5Fcreate.c + * \par Example + * \snippet H5F_examples.c minimal * * \note #H5F_ACC_TRUNC and #H5F_ACC_EXCL are mutually exclusive; use * exactly one. @@ -403,6 +398,9 @@ H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_ * identifier should be closed by calling H5Fclose() when it is no * longer needed. * + * \par Example + * \snippet H5F_examples.c open + * * \note #H5F_ACC_RDWR and #H5F_ACC_RDONLY are mutually exclusive; use * exactly one. * @@ -494,6 +492,9 @@ H5_DLL hid_t H5Freopen(hid_t file_id); * global or local. Valid values are as follows: * \scopes * + * \par Example + * \snippet H5F_examples.c flush + * * \attention HDF5 does not possess full control over buffering. H5Fflush() * flushes the internal HDF5 buffers then asks the operating system * (the OS) to flush the system buffers for the open files. After @@ -503,11 +504,6 @@ H5_DLL hid_t H5Freopen(hid_t file_id); */ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); /** - * \example H5Fclose.c - * After creating an HDF5 file with H5Fcreate(), we close it with - * H5Fclose(). - */ -/** * \ingroup H5F * * \brief Terminates access to an HDF5 file @@ -523,8 +519,8 @@ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); * identifier, or shared datatype identifier), the file will be fully * closed and access will end. * - * Use H5Fclose() as shown in the following example: - * \include H5Fclose.c + * \par Example + * \snippet H5F_examples.c minimal * * \note \Bold{Delayed close:} Note the following deviation from the * above-described behavior. If H5Fclose() is called for a file but one @@ -642,7 +638,7 @@ H5_DLL hid_t H5Fget_access_plist(hid_t file_id); * \note The function will not return an error if intent is NULL; it will * simply do nothing. * - * \version 1.10.0 C function enhanced to work with SWMR functionality. + * \version 1.10.0 Function enhanced to work with SWMR functionality. * * \since 1.8.0 * @@ -694,7 +690,7 @@ H5_DLL herr_t H5Fget_fileno(hid_t file_id, unsigned long *fileno); * \c (#H5F_OBJ_DATASET|#H5F_OBJ_GROUP) would call for datasets and * groups. * - * \version 1.6.8, 1.8.2 C function return type changed to \c ssize_t. + * \version 1.6.8, 1.8.2 Function return type changed to \c ssize_t. * \version 1.6.5 #H5F_OBJ_LOCAL has been added as a qualifier on the types * of objects to be counted. #H5F_OBJ_LOCAL restricts the * search to objects opened through current file identifier. @@ -732,9 +728,9 @@ H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); * To retrieve a count of open objects, use the H5Fget_obj_count() * function. This count can be used to set the \p max_objs parameter. * - * \version 1.8.2 C function return type changed to \c ssize_t and \p + * \version 1.8.2 Function return type changed to \c ssize_t and \p * max_objs parameter datatype changed to \c size_t. - * \version 1.6.8 C function return type changed to \c ssize_t and \p + * \version 1.6.8 Function return type changed to \c ssize_t and \p * max_objs parameter datatype changed to \c size_t. * \since 1.6.0 * @@ -785,6 +781,9 @@ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); * attribute, then the file will be mounted at the location where the * attribute, dataset, or named datatype is attached. * + * \par Example + * \snippet H5F_examples.c mount + * * \note To date, no file mount properties have been defined in HDF5. The * proper value to pass for \p plist is #H5P_DEFAULT, indicating the * default file mount property list. @@ -855,8 +854,6 @@ H5_DLL hssize_t H5Fget_freespace(hid_t file_id); * if any, the HDF5 portion of the file, and any data that may have * been appended beyond the data written through the HDF5 library. * - * \version 1.6.3 Fortran subroutine introduced in this release. - * * \since 1.6.3 * */ @@ -935,9 +932,7 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); * * \note \Bold{Recommended Reading:} This function is part of the file image * operations feature set. It is highly recommended to study the guide - * "HDF5 File Image Operations" before using this feature set.\n See the - * "See Also" section below for links to other elements of HDF5 file - * image operations. \todo Fix the references. + * \ref_file_image_ops before using this feature set. * * \attention H5Pget_file_image() will fail, returning a negative value, if the * file is too large for the supplied buffer. @@ -945,8 +940,6 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); * \see H5LTopen_file_image(), H5Pset_file_image(), H5Pget_file_image(), * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks() * - * \version 1.8.13 Fortran subroutine added in this release. - * * \since 1.8.0 * */ @@ -963,197 +956,18 @@ H5_DLL ssize_t H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len); * \ref H5AC-cache-config-t "here". * \return \herr_t * + * \note The \c in direction applies only to the H5AC_cache_config_t::version + * field. All other fields are out parameters. + * * \details H5Fget_mdc_config() loads the current metadata cache configuration * into the instance of H5AC_cache_config_t pointed to by the \p config_ptr - * parameter. - * - * Note that the \c version field of \p config_ptr must be initialized - * --this allows the library to support old versions of the H5AC_cache_config_t - * structure. - * - * \par General configuration section - * <table> - * <tr> - * <td><em>int</em> <code>version</code> </td> - * <td>IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This field should - * be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined in H5ACpublic.h).</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>rpt_fcn_enabled</code> </td> - * <td><p>OUT: Boolean flag indicating whether the adaptive cache resize report function is enabled. This - * field should almost always be set to disabled (<code>0</code>). Since resize algorithm activity is - * reported via stdout, it MUST be set to disabled (<code>0</code>) on Windows machines.</p><p>The - * report function is not supported code, and can be expected to change between versions of the - * library. Use it at your own risk.</p></td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>open_trace_file</code> </td> - * <td>OUT: Boolean field indicating whether the <code>trace_file_name</code> field should be used to - * open a trace file for the cache. This field will always be set to <code>0</code> in this - * context.</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>close_trace_file</code> </td> - * <td>OUT: Boolean field indicating whether the current trace file (if any) should be closed. This field - * will always be set to <code>0</code> in this context.</td></tr> - * <tr> - * <td><em>char*</em><code>trace_file_name</code> </td> - * <td>OUT: Full path name of the trace file to be opened if the <code>open_trace_file</code> field is - * set to <code>1</code>. This field will always be set to the empty string in this context.</td></tr> - * <tr> - * <td><em>hbool_t</em> <code>evictions_enabled</code> </td> - * <td>OUT: Boolean flag indicating whether metadata cache entry evictions are - * enabled.</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>set_initial_size</code> </td> - * <td>OUT: Boolean flag indicating whether the cache should be created with a user specified initial - * maximum size.<p>If the configuration is loaded from the cache, this flag will always be set - * to <code>0</code>.</p></td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>initial_size</code> </td> - * <td>OUT: Initial maximum size of the cache in bytes, if applicable.<p>If the configuration is loaded - * from the cache, this field will contain the cache maximum size as of the time of the - * call.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>min_clean_fraction</code> </td> - * <td>OUT: Float value specifying the minimum fraction of the cache that must be kept either clean or - * empty when possible.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>max_size</code> </td> - * <td>OUT: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>min_size</code> </td> - * <td>OUT: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.</td> - * </tr> - * <tr> - * <td><em>long int</em> <code>epoch_length</code> </td> - * <td>OUT: Number of cache accesses between runs of the adaptive cache resize - * code.</td> - * </tr> - * </table> - * - * \par Increment configuration section - * <table> - * <tr> - * <td><em>enum H5C_cache_incr_mode</em> <code>incr_mode</code> </td> - * <td>OUT: Enumerated value indicating the operational mode of the automatic cache size increase code. - * At present, only the following values are legal:<p>\c H5C_incr__off: Automatic cache size increase - * is disabled.</p><p>\c H5C_incr__threshold: Automatic cache size increase is enabled using the hit - * rate threshold algorithm.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>lower_hr_threshold</code> </td> - * <td>OUT: Hit rate threshold used in the hit rate threshold cache size increase algorithm.</td> - * </tr> - * <tr> - * <td><em>double</em> <code>increment</code> </td> - * <td>OUT: The factor by which the current maximum cache size is multiplied to obtain an initial new - * maximum cache size if a size increase is triggered in the hit rate threshold cache size increase - * algorithm.</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>apply_max_increment</code> </td> - * <td>OUT: Boolean flag indicating whether an upper limit will be applied to the size of cache size - * increases.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>max_increment</code> </td> - * <td>OUT: The maximum number of bytes by which the maximum cache size can be increased in a single step - * -- if applicable.</td> - * </tr> - * <tr> - * <td><em>enum H5C_cache_flash_incr_mode</em> <code>flash_incr_mode</code> </td> - * <td>OUT: Enumerated value indicating the operational mode of the flash cache size increase code. At - * present, only the following values are legal:<p>\c H5C_flash_incr__off: Flash cache size increase is - * disabled.</p><p>\c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add - * space algorithm.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>flash_threshold</code> </td> - * <td>OUT: The factor by which the current maximum cache size is multiplied to obtain the minimum size - * entry / entry size increase which may trigger a flash cache size - * increase.</td> - * </tr> - * <tr> - * <td><em>double</em> <code>flash_multiple</code> </td> - * <td>OUT: The factor by which the size of the triggering entry / entry size increase is multiplied to - * obtain the initial cache size increment. This increment may be reduced to reflect existing free - * space in the cache and the <code>max_size</code> field above.</td> - * </tr> - * </table> - * - * \par Decrement configuration section - * <table> - * <tr><td colspan="2"><strong>Decrement configuration - * section:</strong></td> - * </tr> - * <tr> - * <td><em>enum H5C_cache_decr_mode</em> <code>decr_mode</code> </td> - * <td>OUT: Enumerated value indicating the operational mode of the automatic cache size decrease code. - * At present, the following values are legal:<p>H5C_decr__off: Automatic cache size decrease is - * disabled, and the remaining decrement fields are ignored.</p><p>H5C_decr__threshold: Automatic - * cache size decrease is enabled using the hit rate threshold algorithm.</p><p>H5C_decr__age_out: - * Automatic cache size decrease is enabled using the ageout algorithm.</p> - * <p>H5C_decr__age_out_with_threshold: Automatic cache size decrease is enabled using the ageout - * with hit rate threshold algorithm</p></td> - * </tr> - * <tr><td><em>double</em> <code>upper_hr_threshold</code> </td> - * <td>OUT: Upper hit rate threshold. This value is only used if the decr_mode is either - * H5C_decr__threshold or H5C_decr__age_out_with_threshold.</td> - * </tr> - * <tr> - * <td><em>double</em> <code>decrement</code> </td> - * <td>OUT: Factor by which the current max cache size is multiplied to obtain an initial value for the - * new cache size when cache size reduction is triggered in the hit rate threshold cache size reduction - * algorithm.</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>apply_max_decrement</code> </td> - * <td>OUT: Boolean flag indicating whether an upper limit should be applied to the size of cache size - * decreases.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>max_decrement</code> </td> - * <td>OUT: The maximum number of bytes by which cache size can be decreased if any single step, if - * applicable.</td> - * </tr> - * <tr> - * <td><em>int</em> <code>epochs_before_eviction</code> </td> - * <td>OUT: The minimum number of epochs that an entry must reside unaccessed in cache before being - * evicted under either of the ageout cache size reduction algorithms.</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>apply_empty_reserve</code> </td> - * <td>OUT: Boolean flag indicating whether an empty reserve should be maintained under either of the - * ageout cache size reduction algorithms.</td> - * </tr> - * <tr> - * <td><em>double</em> <code>empty_reserve</code> </td> - * <td>OUT: Empty reserve for use with the ageout cache size reduction algorithms, if applicable.</td> - * </tr> - * </table> - * - * \par Parallel configuration section - * <table> - * <tr><td><em>int</em> <code>dirty_bytes_threshold</code> </td> - * <td>OUT: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the - * metadata caches serving the target file in the parallel case.<p>Synchronization occurs whenever the - * number of bytes of dirty metadata created since the last synchronization exceeds this - * limit.</p></td> - * </tr> - * </table> + * parameter.\n + * The fields of the H5AC_cache_config_t structure are shown below: + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more * * \since 1.8.0 * - * \todo Fix the reference! - * */ H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); /** @@ -1170,240 +984,11 @@ H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); * * \details H5Fset_mdc_config() attempts to configure the file's metadata cache * according configuration supplied in \p config_ptr. - * - * \par General configuration fields - * <table> - * <tr> - * <td><em>int</em> <code>version</code></td> - * <td>IN: Integer field indicating the the version of the H5AC_cache_config_t in use. This - * field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION (defined - * in H5ACpublic.h).</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>rpt_fcn_enabled</code></td> - * <td>IN: Boolean flag indicating whether the adaptive cache resize report function is enabled. This - * field should almost always be set to disabled (<code>0</code>). Since resize algorithm activity is - * reported via stdout, it MUST be set to disabled (<code>0</code>) on Windows machines.<p>The report - * function is not supported code, and can be expected to change between versions of the library. Use - * it at your own risk.</p></td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>open_trace_File</code></td> - * <td>IN: Boolean field indicating whether the <code>trace_file_name</code> field should be used to open - * a trace file for the cache.<p>The trace file is a debuging feature that allows the capture of top - * level metadata cache requests for purposes of debugging and/or optimization. This field should - * <p>This field should only normally be set to <code>0</code>, as trace file collection imposes - * considerable overhead.</p> be set to <code>1</code> when the <code>trace_file_name</code> contains - * the full path of the desired trace file, and either there is no open trace file on the cache, or the - * <code>close_trace_file</code> field is also <code>1</code>.</p><p>The trace file feature is - * unsupported unless used at the direction of The HDF Group. It is intended to allow The HDF Group to - * collect a trace of cache activity in cases of occult failures and/or poor performance seen in the - * field, so as to aid in reproduction in the lab. If you use it absent the direction of The HDF Group, - * you are on your own.</p></td> - * </tr> - * <tr><td><em>hbool_t</em> <code>close_trace_file</code></td> - * <td>IN: Boolean field indicating whether the current trace file (if any) should be closed.<p>See the - * above comments on the <code>open_trace_file</code> field. This field should be set to - * <code>0</code> unless there is an open trace file on the cache that you wish to close.</p><p>The - * trace file feature is unsupported unless used at the direction of The HDF Group. It is intended to - * allow The HDF Group to collect a trace of cache activity in cases of occult failures and/or poor - * performance seen in the field, so as to aid in reproduction in the lab. If you use it absent the - * direction of The HDF Group, you are on your own.</p></td> - * </tr> - * <tr> - * <td><em>char</em> <code>trace_file_name[]</code></td> - * <td>IN: Full path of the trace file to be opened if the <code>open_trace_file</code> field is set - * to <code>1</code>.<p>In the parallel case, an ascii representation of the mpi rank of the process - * will be appended to the file name to yield a unique trace file name for each process.</p><p>The - * length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN characters.</p><p>The trace file - * feature is unsupported unless used at the direction of The HDF Group. It is intended to allow The - * HDF Group to collect a trace of cache activity in cases of occult failures and/or poor performance - * seen in the field, so as to aid in reproduction in the lab. If you use it absent the direction of - * The HDF Group, you are on your own.</p></td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>evictions_enabled</code></td> - * <td>IN: A boolean flag indicating whether evictions from the metadata cache are enabled. This flag is - * initially set to enabled (<code>1</code>).<p>In rare circumstances, the raw data throughput - * requirements may be so high that the user wishes to postpone metadata writes so as to reserve I/O - * throughput for raw data. The <code>evictions_enabled</code> field exists to allow this. However, - * this is an extreme step, and you have no business doing it unless you have read the User Guide - * section on metadata caching, and have considered all other options carefully.</p><p>The - * <code>evictions_enabled</code> field may not be set to disabled (<code>0</code>) unless all adaptive - * cache resizing code is disabled via the <code>incr_mode</code>, <code>flash_incr_mode</code>, and - * <code>decr_mode</code> fields.</p><p>When this flag is set to disabled (<code>0</code>), the - * metadata cache will not attempt to evict entries to make space for new entries, and thus will grow - * without bound.</p><p>Evictions will be re-enabled when this field is set back to <code>1</code>. - * This should be done as soon as possible.</p></td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>set_initial_size</code></td> - * <td>IN: Boolean flag indicating whether the cache should be forced to the user specified initial - * size.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>initial_size</code></td> - * <td>IN: If <code>set_initial_size</code> is set to <code>1</code>, then <code>initial_size</code> must - * contain the desired initial size in bytes. This value must lie in the closed interval - * <code>[min_size, max_size]</code>. (see below)</td> - * </tr> - * <tr><td><em>double</em> <code>min_clean_fraction</code></td> - * <td>IN: This field specifies the minimum fraction of the cache that must be kept either clean or - * empty.<p>The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to start in the serial - * case. In the parallel case, a larger value is needed -- see <a - * href="/display/HDF5/Metadata+Caching+in+HDF5">Metadata Caching in HDF5</a> in the collection - * "Advanced Topics in HDF5."</p></td> - * </tr> - * <tr><td><em>size_t</em> <code>max_size</code></td> - * <td>IN: Upper bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>min_size</code></td> - * <td>IN: Lower bound (in bytes) on the range of values that the adaptive cache resize code can select - * as the maximum cache size.</td> - * </tr> - * <tr><td><em>long int</em> <code>epoch_length</code></td> - * <td>IN: Number of cache accesses between runs of the adaptive cache resize code. 50,000 is a good - * starting number.</td> - * </tr> - * </table> - * - * \par Increment configuration fields - * <table> - * <tr> - * <td><em>enum H5C_cache_incr_mode</em> <code>incr_mode</code></td> - * <td>IN: Enumerated value indicating the operational mode of the automatic cache size increase code. At - * present, only two values are legal:<p>\c H5C_incr__off: Automatic cache size increase is disabled, - * and the remaining increment fields are ignored.</p><p>\c H5C_incr__threshold: Automatic cache size - * increase is enabled using the hit rate threshold algorithm.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>lower_hr_threshold</code></td> - * <td>IN: Hit rate threshold used by the hit rate threshold cache size increment algorithm.<p>When the - * hit rate over an epoch is below this threshold and the cache is full, the maximum size of the - * cache is multiplied by increment (below), and then clipped as necessary to stay within max_size, and - * possibly max_increment.</p><p>This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good - * starting point.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>increment</code></td> - * <td>IN: Factor by which the hit rate threshold cache size increment algorithm multiplies the current - * maximum cache size to obtain a tentative new cache size.<p>The actual cache size increase will be - * clipped to satisfy the max_size specified in the general configuration, and possibly max_increment - * below.</p><p>The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable - * value.</p><p>If you set it to 1.0, you will effectively disable cache size increases.</p></td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>apply_max_increment</code></td> - * <td>IN: Boolean flag indicating whether an upper limit should be applied to the size of cache size - * increases.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>max_increment</code></td> - * <td>IN: Maximum number of bytes by which cache size can be increased in a single step -- if - * applicable.</td> - * </tr> - * <tr> - * <td><em>enum H5C_cache_flash_incr_mode</em> <code>flash_incr_mode</code></td> - * <td>IN: Enumerated value indicating the operational mode of the flash cache size increase code. At - * present, only the following values are legal:<p>\c H5C_flash_incr__off: Flash cache size increase is - * disabled.</p><p>\c H5C_flash_incr__add_space: Flash cache size increase is enabled using the add - * space algorithm.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>flash_threshold</code></td> - * <td>IN: The factor by which the current maximum cache size is multiplied to obtain the minimum size - * entry / entry size increase which may trigger a flash cache size increase.<p>At present, this value - * must lie in the range [0.1, 1.0].</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>flash_multiple</code></td> - * <td>IN: The factor by which the size of the triggering entry / entry size increase is multiplied to - * obtain the initial cache size increment. This increment may be reduced to reflect existing free - * space in the cache and the <code>max_size</code> field above.<p>At present, this field must lie in - * the range [0.1, 10.0].</p></td> - * </tr> - * </table> - * - * \par Decrement configuration fields - * <table> - * <tr> - * <td><em>enum H5C_cache_decr_mode</em> <code>decr_mode</code></td> - * <td>IN: Enumerated value indicating the operational mode of the automatic cache size decrease code. At - * present, the following values are legal:<p>\c H5C_decr__off: Automatic cache size decrease is - * disabled.</p><p>\c H5C_decr__threshold: Automatic cache size decrease is enabled using the hit - * rate threshold algorithm.</p><p>\c H5C_decr__age_out: Automatic cache size decrease is enabled using - * the ageout algorithm.</p><p>\c H5C_decr__age_out_with_threshold: Automatic cache size decrease is - * enabled using the ageout with hit rate threshold algorithm</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>upper_hr_threshold</code></td> - * <td>IN: Hit rate threshold for the hit rate threshold and ageout with hit rate threshold cache size - * decrement algorithms.<p>When \c decr_mode is \c H5C_decr__threshold, and the hit rate over a given - * epoch exceeds the supplied threshold, the current maximum cache size is multiplied by decrement to - * obtain a tentative new (and smaller) maximum cache size.</p><p>When \c decr_mode is \c - * H5C_decr__age_out_with_threshold, there is no attempt to find and evict aged out entries unless the - * hit rate in the previous epoch exceeded the supplied threshold.</p><p>This field must lie in the - * interval [0.0, 1.0].</p><p>For \c H5C_incr__threshold, .9995 or .99995 is a good place to - * start.</p><p>For \c H5C_decr__age_out_with_threshold, .999 might be more useful.</p></td> - * </tr> - * <tr> - * <td><em>double</em> <code>decrement</code></td> - * <td>IN: In the hit rate threshold cache size decrease algorithm, this parameter contains the factor by - * which the current max cache size is multiplied to produce a tentative new cache size.<p>The actual - * cache size decrease will be clipped to satisfy the min_size specified in the general configuration, - * and possibly max_decrement below.</p><p>The parameter must be be in the interval - * [0.0, 1.0].</p><p>If you set it to 1.0, you will effectively disable cache size decreases. 0.9 is a - * reasonable starting point.</p></td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>apply_max_decrement</code></td> - * <td>IN: Boolean flag indicating whether an upper limit should be applied to the size of cache size - * decreases.</td> - * </tr> - * <tr> - * <td><em>size_t</em> <code>max_decrement</code></td> - * <td>IN: Maximum number of bytes by which the maximum cache size can be decreased in any single step -- - * if applicable.</td> - * </tr> - * <tr> - * <td><em>int</em> <code>epochs_before_eviction</code></td> - * <td>IN: In the ageout based cache size reduction algorithms, this field contains the minimum number of - * epochs an entry must remain unaccessed in cache before the cache size reduction algorithm tries to - * evict it. 3 is a reasonable value.</td> - * </tr> - * <tr> - * <td><em>hbool_t</em> <code>apply_empty_reserve</code></td> - * <td>IN: Boolean flag indicating whether the ageout based decrement algorithms will maintain a empty - * reserve when decreasing cache size.</td> - * </tr> - * <tr> - * <td><em>double</em> <code>empty_reserve</code></td> - * <td>IN: Empty reserve as a fraction of maximum cache size if applicable.<p>When so directed, the - * ageout based algorithms will not decrease the maximum cache size unless the empty reserve can be - * met.</p><p>The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to - * start.</p></td> - * </tr> - * </table> - * - * \par Parallel configuration fields - * <table> - * <tr> - * <td><em>int</em> <code>dirty_bytes_threshold</code></td> - * <td>IN: Threshold number of bytes of dirty metadata generation for triggering synchronizations of the - * metadata caches serving the target file in the parallel case.<p>Synchronization occurs whenever the - * number of bytes of dirty metadata created since the last synchronization exceeds this - * limit.</p><p>This field only applies to the parallel case. While it is ignored elsewhere, it can - * still draw a value out of bounds error.</p><p>It must be consistant across all caches on any given - * file.</p><p>By default, this field is set to 256 KB. It shouldn't be more than half the current - * maximum cache size times the minimum clean fraction.</p></td> - * </tr> - * </table> + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more * * \since 1.8.0 * - * \todo Fix the MDC document reference! */ H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr); /** @@ -1482,13 +1067,12 @@ H5_DLL herr_t H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_c * is enabled. However, the call should be useful if you choose to control metadata cache size from your * program. * - * See "Metadata Caching in HDF5" for details about the metadata cache and the adaptive cache resizing + * See \ref_mdc_in_hdf5 for details about the metadata cache and the adaptive cache resizing * algorithms. If you have not read, understood, and thought about the material covered in that * documentation, * you should not be using this API call. * \endparblock * - * \todo Fix the MDC document reference! */ H5_DLL herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id); /** @@ -1784,6 +1368,9 @@ H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id); * For the parameters \p low and \p high, see the description for * H5Pset_libver_bounds(). * + * \par Example + * \snippet H5F_examples.c libver_bounds + * * \since 1.10.2 * */ @@ -1822,7 +1409,7 @@ H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t * list, and H5Fget_mdc_logging_status() will return the current state of * the logging flags. * - * The log format is described in the \Emph{Metadata Cache Logging} document. + * The log format is described in the \ref_mdc_logging document. * * \note Logging can only be started or stopped if metadata cache logging was enabled * via H5Pset_mdc_log_options().\n @@ -1836,8 +1423,6 @@ H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t * * \since 1.10.0 * - * \todo Fix the document reference! - * */ H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id); /** @@ -1874,7 +1459,7 @@ H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id); * list, and H5Fget_mdc_logging_status() will return the current state of * the logging flags. * - * The log format is described in the \Emph{Metadata Cache Logging} document. + * The log format is described in the \ref_mdc_logging document. * * \note Logging can only be started or stopped if metadata cache logging was enabled * via H5Pset_mdc_log_options().\n @@ -1920,7 +1505,7 @@ H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id); * list, and H5Fget_mdc_logging_status() will return the current state of * the logging flags. * - * The log format is described in the \Emph{Metadata Cache Logging} document. + * The log format is described in the \ref_mdc_logging document. * * \note Unlike H5Fstart_mdc_logging() and H5Fstop_mdc_logging(), this function can * be called on any open file identifier. @@ -1931,7 +1516,7 @@ H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hboo /** * \ingroup SWMR * - * \todo Finish this! + * \todo UFO? */ H5_DLL herr_t H5Fformat_convert(hid_t fid); /** @@ -1985,7 +1570,7 @@ H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], u * \brief Obtains information about a cache image if it exists * * \file_id - * \param[out] image_addr Offset of the cache image if it exists, or #HADDR_UNDEF if it does not + * \param[out] image_addr Offset of the cache image if it exists, or \c HADDR_UNDEF if it does not * \param[out] image_size Length of the cache image if it exists, or 0 if it does not * \returns \herr_t * @@ -2125,11 +1710,10 @@ H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize); * the desired behavior. * \endparblock * - * \see Enabling a Strict Consistency Semantics Model in Parallel HDF5 + * \see \ref_cons_semantics * * \since 1.8.9 * - * \todo Fix the reference! */ H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); /** @@ -2149,11 +1733,10 @@ H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag); * Upon successful return, \p flag will be set to \c 1 if file access is set * to atomic mode and \c 0 if file access is set to nonatomic mode. * - * \see Enabling a Strict Consistency Semantics Model in Parallel HDF5 + * \see \ref_cons_semantics * * \since 1.8.9 * - * \todo Fix the reference! */ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #endif /* H5_HAVE_PARALLEL */ @@ -2165,14 +1748,14 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /**< Print debug info \deprecated In which version? */ /* Typedefs */ /** * Current "global" information about file */ -//! [H5F_info1_t_snip] +//! <!-- [H5F_info1_t_snip] --> typedef struct H5F_info1_t { hsize_t super_ext_size; /**< Superblock extension size */ struct { @@ -2180,7 +1763,7 @@ typedef struct H5F_info1_t { H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ } sohm; } H5F_info1_t; -//! [H5F_info1_t_snip] +//! <!-- [H5F_info1_t_snip] --> /* Function prototypes */ /** @@ -2218,7 +1801,7 @@ typedef struct H5F_info1_t { * header indexes. Each index might be either a B-tree or * a list. * - * \version 1.10.0 C function H5Fget_info() renamed to H5Fget_info1() and + * \version 1.10.0 Function H5Fget_info() renamed to H5Fget_info1() and * deprecated in this release. * * \since 1.8.0 diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h index 5a87917..fe26bd2 100644 --- a/src/H5Gmodule.h +++ b/src/H5Gmodule.h @@ -29,4 +29,96 @@ #define H5_MY_PKG_ERR H5E_SYM #define H5_MY_PKG_INIT YES +/** + * \defgroup H5G H5G + * + * \details \Bold{Groups in HDF5:} A group associates names with objects and + * provides a mechanism for mapping a name to an object. Since all + * objects appear in at least one group (with the possible exception of + * the root object) and since objects can have names in more than one + * group, the set of all objects in an HDF5 file is a directed + * graph. The internal nodes (nodes with out-degree greater than zero) + * must be groups while the leaf nodes (nodes with out-degree zero) are + * either empty groups or objects of some other type. Exactly one + * object in every non-empty file is the root object. The root object + * always has a positive in-degree because it is pointed to by the file + * super block. + * + * \Bold{Locating objects in the HDF5 file hierarchy:} An object name + * consists of one or more components separated from one another by + * slashes. An absolute name begins with a slash and the object is + * located by looking for the first component in the root object, then + * looking for the second component in the first object, etc., until + * the entire name is traversed. A relative name does not begin with a + * slash and the traversal begins at the location specified by the + * create or access function. + * + * \Bold{Group implementations in HDF5:} The original HDF5 group + * implementation provided a single indexed structure for link + * storage. A new group implementation, in HDF5 Release 1.8.0, enables + * more efficient compact storage for very small groups, improved link + * indexing for large groups, and other advanced features. + * + * \li The \Emph{original indexed} format remains the default. Links + * are stored in a B-tree in the group’s local heap. + * \li Groups created in the new \Emph{compact-or-indexed} format, the + * implementation introduced with Release 1.8.0, can be tuned for + * performance, switching between the compact and indexed formats + * at thresholds set in the user application. + * - The \Emph{compact} format will conserve file space and processing + * overhead when working with small groups and is particularly + * valuable when a group contains no links. Links are stored + * as a list of messages in the group’s header. + * - The \Emph{indexed} format will yield improved + * performance when working with large groups, e.g., groups + * containing thousands to millions of members. Links are stored in + * a fractal heap and indexed with an improved B-tree. + * \li The new implementation also enables the use of link names consisting of + * non-ASCII character sets (see H5Pset_char_encoding()) and is + * required for all link types other than hard or soft links, e.g., + * external and user-defined links (see the \ref H5L APIs). + * + * The original group structure and the newer structures are not + * directly interoperable. By default, a group will be created in the + * original indexed format. An existing group can be changed to a + * compact-or-indexed format if the need arises; there is no capability + * to change back. As stated above, once in the compact-or-indexed + * format, a group can switch between compact and indexed as needed. + * + * Groups will be initially created in the compact-or-indexed format + * only when one or more of the following conditions is met: + * \li The low version bound value of the library version bounds property + * has been set to Release 1.8.0 or later in the file access property + * list (see H5Pset_libver_bounds()). Currently, that would require an + * H5Pset_libver_bounds() call with the low parameter set to + * #H5F_LIBVER_LATEST.\n When this property is set for an HDF5 file, + * all objects in the file will be created using the latest available + * format; no effort will be made to create a file that can be read by + * older libraries. + * \li The creation order tracking property, #H5P_CRT_ORDER_TRACKED, has been + * set in the group creation property list (see H5Pset_link_creation_order()). + * + * An existing group, currently in the original indexed format, will be + * converted to the compact-or-indexed format upon the occurrence of + * any of the following events: + * \li An external or user-defined link is inserted into the group. + * \li A link named with a string composed of non-ASCII characters is + * inserted into the group. + * + * The compact-or-indexed format offers performance improvements that + * will be most notable at the extremes, i.e., in groups with zero + * members and in groups with tens of thousands of members. But + * measurable differences may sometimes appear at a threshold as low as + * eight group members. Since these performance thresholds and criteria + * differ from application to application, tunable settings are + * provided to govern the switch between the compact and indexed + * formats (see H5Pset_link_phase_change()). Optimal thresholds will + * depend on the application and the operating environment. + * + * Future versions of HDF5 will retain the ability to create, read, + * write, and manipulate all groups stored in either the original + * indexed format or the compact-or-indexed format. + * + */ + #endif /* H5Gmodule_H */ diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 99134f8..7f1faf8 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -41,22 +41,31 @@ /* Public Typedefs */ /*******************/ -/* Types of link storage for groups */ +//! <!-- [H5G_storage_t_snip] --> +/** + * Types of link storage for groups + */ typedef enum H5G_storage_type_t { - H5G_STORAGE_TYPE_UNKNOWN = -1, /* Unknown link storage type */ - H5G_STORAGE_TYPE_SYMBOL_TABLE, /* Links in group are stored with a "symbol table" */ - /* (this is sometimes called "old-style" groups) */ - H5G_STORAGE_TYPE_COMPACT, /* Links are stored in object header */ - H5G_STORAGE_TYPE_DENSE /* Links are stored in fractal heap & indexed with v2 B-tree */ + H5G_STORAGE_TYPE_UNKNOWN = -1, /**< Unknown link storage type */ + H5G_STORAGE_TYPE_SYMBOL_TABLE, /**< Links in group are stored with a "symbol table" */ + /**< (this is sometimes called "old-style" groups) */ + H5G_STORAGE_TYPE_COMPACT, /**< Links are stored in object header */ + H5G_STORAGE_TYPE_DENSE /**< Links are stored in fractal heap & indexed with v2 B-tree */ } H5G_storage_type_t; +//! <!-- [H5G_storage_t_snip] --> -/* Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) */ +//! <!-- [H5G_info_t_snip] --> +/** + * Information struct for group for + * H5Gget_info(), H5Gget_info_by_name(), and H5Gget_info_by_idx() + */ typedef struct H5G_info_t { - H5G_storage_type_t storage_type; /* Type of storage for links in group */ - hsize_t nlinks; /* Number of links in group */ - int64_t max_corder; /* Current max. creation order value for group */ - hbool_t mounted; /* Whether group has a file mounted on it */ + H5G_storage_type_t storage_type; /**< Type of storage for links in group */ + hsize_t nlinks; /**< Number of links in group */ + int64_t max_corder; /**< Current max. creation order value for group */ + hbool_t mounted; /**< Whether group has a file mounted on it */ } H5G_info_t; +//! <!-- [H5G_info_t_snip] --> /********************/ /* Public Variables */ @@ -69,18 +78,344 @@ typedef struct H5G_info_t { extern "C" { #endif -H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id); -H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id); -H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id); -H5_DLL hid_t H5Gget_create_plist(hid_t group_id); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a new group and links it into the file + * + * \fgdta_loc_id + * \param[in] name Name of the group to create + * \lcpl_id + * \gcpl_id + * \gapl_id + * + * \return \hid_t{group} + * + * \details H5Gcreate2() creates a new group in a file. After a + * group has been created, links to datasets and to other groups + * can be added. + * + * The \p loc_id and \p name parameters specify where the group + * is located. \p loc_id may be a file, group, dataset, named + * datatype or attribute in the file. If an attribute, dataset, + * or named datatype is specified for \p loc_id then the group + * will be created at the location where the attribute, dataset, + * or named datatype is attached. \p name is the link to the group; + * \p name may be either an absolute path in the file (the links + * from the root group to the new group) or a relative path from + * \p loc_id (the link(s) from the group specified by \p loc_id + * to the new group). + * + * \p lcpl_id, \p gcpl_id, and \p gapl_id are property list + * identifiers. These property lists govern how the link to the + * group is created, how the group is created, and how the group + * can be accessed in the future, respectively. #H5P_DEFAULT can + * be passed in if the default properties are appropriate for + * these property lists. Currently, there are no APIs for the + * group access property list; use #H5P_DEFAULT. + * + * The group identifier should be closed by H5Gclose() when access + * is no longer required to prevent resource leaks. + * + * \since 1.8.0 + * + * \see H5Gopen2(), H5Gclose() + * + */ +H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a new empty group without linking it into the file structure + * + * \fgdta_loc_id + * \gcpl_id + * \gapl_id + * + * \return \hid_t{group} + * + * \details H5Gcreate_anon() creates a new empty group in the file + * specified by \p loc_id. With default settings, H5Gcreate_anon() + * provides similar functionality to that provided by + * H5Gcreate1(), with the differences described in the list below. + * + * The new group’s creation and access properties are specified + * in \p gcpl_id and \p gapl_id, respectively. + * + * H5Gcreate_anon() returns a new group identifier. This identifier + * must be linked into the HDF5 file structure with H5Olink() + * or it will be deleted from the file when the file is closed. + * + * The differences between this function and H5Gcreate1() are + * as follows: + * + * \li H5Gcreate1() does not provide for the use of custom property + * lists; H5Gcreate1() always uses default properties. + * \li H5Gcreate_anon() neither provides the new group’s name + * nor links it into the HDF5 file structure; those actions + * must be performed separately through a call to H5Olink(), + * which offers greater control over linking. + * \li H5Gcreate_anon() does not directly provide a hint mechanism + * for the group’s heap size. Comparable information can be + * included in the group creation property list \p gcpl_id through + * a H5Pset_local_heap_size_hint() call. + * + * A group created with this function should be closed with + * H5Gclose() when the group is no longer needed so that resource + * leaks will not develop. + * + * \see H5Olink(), H5Dcreate(), Using Identifiers + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Opens an existing group in a file + * + * \fgdta_loc_id + * \param[in] name Name of the group to open + * \gapl_id + * + * \return \hid_t{group} + * + * \details H5Gopen2() opens an existing group, \p name, at the location + * specified by \p loc_id. + * + * With default settings, H5Gopen2() provides similar functionality + * to that provided by H5Gopen(). The only difference is that + * H5Gopen2() can provide a group access property list, \p gapl_id. + * + * H5Gopen2() returns a group identifier for the group that was + * opened. This group identifier should be released by H5Gclose() + * when it is no longer needed to prevent resource leaks. + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ +H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Gets a group creation property list identifier + * + * \group_id + * + * \return \hid_t{creation property list} + * + * \details H5Gget_create_plist() returns an identifier for the group creation + * property list associated with the group specified by \p group_id. + * + * The creation property list identifier should be released with + * H5Gclose() to prevent resource leaks. + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ +H5_DLL hid_t H5Gget_create_plist(hid_t group_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Retrieves information about a group + * + * \fgdta_loc_id + * \param[out] ginfo Struct in which group information is returned + * + * \return \hid_t{group} + * + * \details H5Gget_info() retrieves information about the group at location + * specified by \p loc_id. The information is returned in the \p ginfo. + * + * \p ginfo is an H5G_info_t struct and is defined (in H5Gpublic.h) + * as follows: + * + * \snippet this H5G_info_t_snip + * Possible values of \p storage_type are: + * \storage_type + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Retrieves information about a group by its name + * + * \fgdta_loc_id + * \param[in] name Name of the group to query + * \param[out] ginfo Struct in which group information is returned + * \lapl_id + * + * \return \herr_t + * + * \details H5Gget_info_by_name() retrieves information about the group \p name + * at location specified by \p loc_id. The information is returned in + * the \p ginfo struct. + * + * If \p loc_id specifies the group for which information is queried, + * then the group's \p name can be a dot (.). + * + * \p ginfo is an H5G_info_t struct and is defined (in H5Gpublic.h) + * as follows: + * + * \snippet this H5G_info_t_snip + * Possible values of \p storage_type are: + * \storage_type + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *ginfo, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Retrieves information about a group, according to the group’s + * position within an index + * + * \fgdta_loc_id + * \param[in] group_name Name of the group to query + * \param[in] idx_type Transient index identifying object + * \param[in] order Transient index identifying object + * \param[in] n Position in the index of the group to query + * \param[out] ginfo Struct in which group information is returned + * \lapl_id + * + * \return Returns + * \li The size of the object name if successful, or + * \li 0 if no name is associated with the group identifier, or + * \li negative value, if failure occurred + * + * \details H5Gget_info_by_idx() retrieves the same information + * about a group as retrieved by the function H5Gget_info(), + * but the means of identifying the group differs; the group is + * identified by position in an index rather than by name. + * + * \p loc_id and \p group_name specify the group containing + * the group for which information is sought. The groups in \p + * group_name are indexed by \p idx_type; the group for which + * information is retrieved is identified in that index by index + * order, \p order, and index position, \p n. + * + * If \p loc_id specifies the group containing the group for + * which information is queried, \p group_name can be a dot (.). + * + * Valid values for \p index_type are as follows: + * \indexes + * The order in which the index is to be examined, as specified + * by \p order, can be one of the following: + * \orders + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo, hid_t lapl_id); -H5_DLL herr_t H5Gclose(hid_t group_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Flushes all buffers associated with a group to disk + * + * \group_id + * + * \return \herr_t + * + * \details H5Gflush() causes all buffers associated with a group to be + * immediately flushed to disk without removing the data from + * the cache. + * + * \attention + * HDF5 does not possess full control over buffering. H5G_FLUSH + * flushes the internal HDF5 buffers and then asks the operating + * system (the OS) to flush the system buffers for the open + * files. After that, the OS is responsible for ensuring that + * the data is actually flushed to disk. + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ H5_DLL herr_t H5Gflush(hid_t group_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Refreshes all buffers associated with a group + * + * \group_id + * + * \return \herr_t + * + * \details H5Grefresh() causes all buffers associated with a group to be + * cleared and immediately re-loaded with updated contents from disk. + * + * This function essentially closes the group, evicts all + * metadata associated with it from the cache, and then re-opens + * the group. The reopened group is automatically re-registered + * with the same identifier. + * + * \since 1.8.0 + * + * \see H5Gcreate2(), H5Gclose() + * + */ H5_DLL herr_t H5Grefresh(hid_t group_id); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Closes the specified group + * + * \group_id + * + * \return \herr_t + * + * \details H5Gclose() releases resources used by a group which was + * opened by H5Gcreate() or H5Gopen(). After closing a group, + * \p group_id cannot be used again until another H5Gcreate() + * or H5Gopen() is called on it. + * + * Failure to release a group with this call will result in + * resource leaks. + * + * \par Example + * \snippet H5F_examples.c mount + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Gclose(hid_t group_id); + /* Symbols defined for compatibility with previous versions of the HDF5 API. * * Use of these symbols is deprecated. @@ -104,56 +439,647 @@ H5_DLL herr_t H5Grefresh(hid_t group_id); /* Typedefs */ -/* +//! <!-- [H5G_obj_t_snip] --> +/** * An object has a certain type. The first few numbers are reserved for use * internally by HDF5. Users may add their own types with higher values. The - * values are never stored in the file -- they only exist while an - * application is running. An object may satisfy the `isa' function for more - * than one type. + * values are never stored in the file -- they only exist while an application + * is running. An object may satisfy the `isa' function for more than one type. + * + * \deprecated */ typedef enum H5G_obj_t { - H5G_UNKNOWN = -1, /* Unknown object type */ - H5G_GROUP, /* Object is a group */ - H5G_DATASET, /* Object is a dataset */ - H5G_TYPE, /* Object is a named data type */ - H5G_LINK, /* Object is a symbolic link */ - H5G_UDLINK, /* Object is a user-defined link */ - H5G_RESERVED_5, /* Reserved for future use */ - H5G_RESERVED_6, /* Reserved for future use */ - H5G_RESERVED_7 /* Reserved for future use */ + H5G_UNKNOWN = -1, /**< Unknown object type */ + H5G_GROUP, /**< Object is a group */ + H5G_DATASET, /**< Object is a dataset */ + H5G_TYPE, /**< Object is a named data type */ + H5G_LINK, /**< Object is a symbolic link */ + H5G_UDLINK, /**< Object is a user-defined link */ + H5G_RESERVED_5, /**< Reserved for future use */ + H5G_RESERVED_6, /**< Reserved for future use */ + H5G_RESERVED_7 /**< Reserved for future use */ } H5G_obj_t; +//! <!-- [H5G_obj_t_snip] --> -/* Prototype for H5Giterate() operator */ +//! <!-- [H5G_iterate_t_snip] --> +/** + * Callback for H5Giterate() + * + * \deprecated + */ typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data); +//! <!-- [H5G_iterate_t_snip] --> -/* Information about an object */ +//! <!-- [H5G_stat_t_snip] --> +/** + * Information about an object + * + * \deprecated + */ typedef struct H5G_stat_t { - unsigned long fileno[2]; /*file number */ - unsigned long objno[2]; /*object number */ - unsigned nlink; /*number of hard links to object*/ - H5G_obj_t type; /*basic object type */ - time_t mtime; /*modification time */ - size_t linklen; /*symbolic link value length */ - H5O_stat_t ohdr; /* Object header information */ + unsigned long fileno[2]; /**< file number */ + unsigned long objno[2]; /**< object number */ + unsigned nlink; /**< number of hard links to object*/ + H5G_obj_t type; /**< basic object type */ + time_t mtime; /**< modification time */ + size_t linklen; /**< symbolic link value length */ + H5O_stat_t ohdr; /**< Object header information */ } H5G_stat_t; +//! <!-- [H5G_stat_t_snip] --> /* Function prototypes */ -H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); -H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); -H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name); -H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, - const char *new_name); -H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); -H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); -H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); -H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/); -H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment); -H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf); -H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data); -H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); -H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, - H5G_stat_t *statbuf /*out*/); -H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a new group and links it into the file + * + * \fgdta_loc_id + * \param[in] name Name of the group to create + * \param[in] size_hint The number of bytes to reserve for the names + * that will appear in the group + * + * \return \hid_t{group} + * + * \deprecated This function is deprecated in favor of H5Gcreate2(). + * + * \details H5Gcreate1() creates a new group with the specified name at the + * specified location, \p loc_id. \p loc_id may be a file, group, + * dataset, named datatype or attribute. If an attribute, dataset, or + * named datatype is specified for \p loc_id then the group will be + * created at the location where the attribute, dataset, or named + * datatype is attached. The name, name, must not already be taken by + * some other object and all parent groups must already exist. + * + * \p name can be a relative path based at \p loc_id or an absolute + * path from the root of the file. Use of this function requires that + * any intermediate groups specified in the path already exist. + * + * The length of a group name, or of the name of any object within a + * group, is not limited. + * + * \p size_hint is a hint for the number of bytes to reserve to store + * the names which will be eventually added to the new group. This + * value must be between 0 and UINT32_MAX (inclusive). If this + * parameter is zero, a default value will be used. + * + * The return value is a group identifier for the open group. This + * group identifier should be closed by calling H5Gclose() when it is + * no longer needed. + * + * See H5Gcreate_anon() for a discussion of the differences between + * H5Gcreate1() and H5Gcreate_anon(). + * + * \par Example + * \snippet H5F_examples.c mount + * + * \version 1.8.0 Function H5Gcreate() renamed to H5Gcreate1() and deprecated + * in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Opens an existing group for modification and returns a group + * identifier for that group + * + * \fgdta_loc_id + * \param[in] name Name of the group to open + * + * \return \hid_t{group} + * + * \deprecated This function is deprecated in favor of H5Gopen2(). + * + * \details H5Gopen1() opens an existing group, \p name, at the location + * specified by \p loc_id. + * + * H5Gopen1() returns a group identifier for the group that was + * opened. This group identifier should be released by calling + * H5Gclose() when it is no longer needed. + * + * \version 1.8.0 The function H5Gopen() was renamed to H5Gopen1() + * and deprecated in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a link of the specified type from \p new_name to \p + * cur_name + * + * \fg_loc_id{cur_loc_id} + * \param[in] type Link type + * \param[in] cur_name Name of the existing object + * \param[in] new_name New name for the object + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Glink() creates a new name for an object that has some current + * name, possibly one of many names it currently has. + * + * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify + * the name of an existing object and both names are interpreted + * relative to \p cur_loc_id, which is either a file identifier or a + * group identifier. + * + * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything + * and is interpreted at lookup time relative to the group which + * contains the final component of \p new_name. For instance, if \p + * cur_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a + * request is made for \Code{./x/y/bar}, then the actual object looked + * up is \Code{./x/y/./foo}. + + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Creates a link of the specified type from \p cur_name to \p + * new_name + * + * \fg_loc_id{cur_loc_id} + * \param[in] cur_name Name of the existing object + * \param[in] type Link type + * \fg_loc_id{new_loc_id} + * \param[in] new_name New name for the object + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Glink2() creates a new name for an object that has some current + * name, possibly one of many names it currently has. + * + * If \p link_type is #H5G_LINK_HARD, then \p cur_name must specify the + * name of an existing object and both names are interpreted relative + * to \p cur_loc_id and \p new_loc_id, respectively, which are either + * file identifiers or group identifiers. + * + * If \p link_type is #H5G_LINK_SOFT, then \p cur_name can be anything + * and is interpreted at lookup time relative to the group which + * contains the final component of \p new_name. For instance, if \p + * current_name is \Code{./foo}, \p new_name is \Code{./x/y/bar}, and a + * request is made for \Code{./x/y/bar}, then the actual object looked + * up is \Code{./x/y/./foo}. + + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, + const char *new_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Renames an object within an HDF5 file + * + * \fg_loc_id{src_loc_id} + * \param[in] src_name Object's original name + * \param[in] dst_name Object's new name + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Gmove() renames an object within an HDF5 file. The original name, + * \p src_name, is unlinked from the group graph and the new name, \p + * dst_name, is inserted as an atomic operation. Both names are + * interpreted relative to \p loc_id, which is either a file or a group + * identifier. + * + * \attention Exercise care in moving groups as it is possible to render data in + * a file inaccessible with H5Gmove(). See The Group Interface in the + * HDF5 User's Guide. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Renames an object within an HDF5 file + * + * \fg_loc_id{src_loc_id} + * \param[in] src_name Object's original name + * \fg_loc_id{dst_loc_id} + * \param[in] dst_name Object's new name + * + * \return \herr_t + * + * \deprecated This function is deprecated. + * + * \details H5Gmove2() renames an object within an HDF5 file. The original name, + * \p src_name, is unlinked from the group graph and the new name, \p + * dst_name, is inserted as an atomic operation. + * + * \p src_name and \p dst_name are interpreted relative to \p + * src_loc_id and \p dst_loc_id, respectively, which are either file or + * group identifiers. + * + * \attention Exercise care in moving groups as it is possible to render data in + * a file inaccessible with H5Gmove2(). See The Group Interface in the + * HDF5 User's Guide. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Removes the link to an object from a group + * + * \fg_loc_id{loc_id} + * \param[in] name Name of the object to unlink + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Ldelete(). + * + * \details H5Gunlink() removes the object specified by \p name from the group + * graph and decrements the link count for the object to which \p name + * points. This action eliminates any association between name and the + * object to which name pointed. + * + * Object headers keep track of how many hard links refer to an object; + * when the link count reaches zero, the object can be removed from the + * file. Objects which are open are not removed until all identifiers + * to the object are closed. + * + * If the link count reaches zero, all file space associated with the + * object will be released, i.e., identified in memory as freespace. If + * any object identifier is open for the object, the space will not be + * released until after the object identifier is closed. + * + * Note that space identified as freespace is available for re-use only + * as long as the file remains open; once a file has been closed, the + * HDF5 library loses track of freespace. See “Freespace Management” in + * the HDF5 User's Guide for further details. + * + * \attention Exercise care in moving groups as it is possible to render data in + * a file inaccessible with H5Gunlink(). See The Group Interface in the + * HDF5 User's Guide. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns the name of the object that the symbolic link points to + * + * \fg_loc_id{loc_id} + * \param[in] name Symbolic link to the object whose name is to be returned + * \param[in] size Maximum number of characters of value to be returned + * \param[out] buf A buffer to hold the name of the object being sought + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Lget_val(). + * + * \details H5Gget_linkval() returns up to size characters of the name of the + * object that the symbolic link name points to. + * + * The parameter \p loc_id is a file or group identifier. + * + * The parameter \p name must be a symbolic link pointing to the + * desired object and must be defined relative to \p loc_id. + * + * If size is smaller than the size of the returned object name, then + * the name stored in the buffer value will not be \c NULL terminated. + * + * This function fails if \p name is not a symbolic link. The presence + * of a symbolic link can be tested by passing zero for \p size and \p + * NULL for value. + * + * This function should be used only after H5Lget_info1() (or the + * deprecated function H5Gget_objinfo()) has been called to verify that + * name is a symbolic link. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Sets comment for specified object + * + * \fgdt_loc_id + * \param[in] name Name of the object whose comment is to be set or reset + * name must be \Code{'.'} (dot) if \p loc_id fully specifies + * the object for which the comment is to be set. + * \param[in] comment The new comment + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function + * H5Oset_comment(). + * + * \details H5Gset_comment() sets the comment for the object specified by \p + * loc_id and name to comment. Any previously existing comment is + * overwritten. + * + * \p loc_id can specify any object in the file. name can be one of the + * following: + * \li The name of the object relative to \p loc_id + * \li An absolute name of the object, starting from \c /, the file’s + * root group + * \li A dot (\c .), if \p loc_id fully specifies the object + * + * If \p comment is the empty string or a null pointer, the comment + * message is removed from the object. + * + * Comments should be relatively short, null-terminated, ASCII strings. + * + * Comments can be attached to any object that has an object header, + * e.g., datasets, groups, and named datatypes, but not symbolic links. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Retrieves comment for specified object + * + * \fgdt_loc_id + * \param[in] name Name of the object whose comment is to be set or reset + * name must be \Code{'.'} (dot) if \p loc_id fully specifies + * the object for which the comment is to be set. + * \param[in] bufsize Maximum number of comment characters to be returned in \p buf. + * \param[in] buf The comment + * + * \return Returns the number of characters in the comment, counting the \c NULL + * terminator, if successful; the value returned may be larger than + * \p bufsize. Otherwise returns a negative value. + * + * \deprecated This function is deprecated in favor of the function + * H5Oget_comment(). + * + * \details H5Gget_comment() retrieves the comment for the the object specified + * by \p loc_id and \p name. The comment is returned in the buffer \p + * buf. + * + * \p loc_id can specify any object in the file. name can be one of the + * following: + * \li The name of the object relative to \p loc_id + * \li An absolute name of the object, starting from \c /, the file’s + * root group + * \li A dot (\c .), if \p loc_id fully specifies the object + * + * At most bufsize characters, including a null-terminator, are + * returned in \p buf. The returned value is not null-terminated if the + * comment is longer than the supplied buffer. If the size of the + * comment is unknown, a preliminary \p H5Gget_comment() call will + * return the size of the comment, including space for the + * null-terminator. + * + * If an object does not have a comment, the empty string is returned + * in comment. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Iterates over the entries of a group invoking a callback for each + * entry encountered + * + * \fg_loc_id + * \param[in] name Group over which the iteration is performed + * \param[in,out] idx Location at which to begin the iteration + * \param[in] op Operation to be performed on an object at each step of the + * iteration + * \param[in,out] op_data Data associated with the operation + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function + * H5Literate1(). + * + * \details H5Giterate() iterates over the members of name in the file or group + * specified with \p loc_id. For each object in the group, the \p + * op_data and some additional information, specified below, are passed + * to the operator function. The iteration begins with the \p idx + * object in the group and the next element to be processed by the + * operator is returned in \p idx. If \p idx is NULL, then the iterator + * starts at the first group member; since no stopping point is + * returned in this case, the iterator cannot be restarted if one of + * the calls to its operator returns non-zero. H5Giterate() does not + * recursively follow links into subgroups of the specified group. + * + * The prototype for \ref H5G_iterate_t is: + * \snippet this H5G_iterate_t_snip + * + * The operation receives the group identifier for the group being + * iterated over, \p group, the name of the current object within + * the group, \p name, and the pointer to the operator data + * passed in to H5Giterate(), \p op_data. + * + * The return values from an operator are: + * \li Zero causes the iterator to continue, returning zero when all + * group members have been processed. + * \li Positive causes the iterator to immediately return that positive + * value, indicating short-circuit success. The iterator can be + * restarted at the next group member. + * \li Negative causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the next + * group member. + * + * H5Giterate() assumes that the membership of the group identified by + * \p name remains unchanged through the iteration. If the membership + * changes during the iteration, the function's behavior is undefined. + * + * H5Giterate() is not recursive. In particular, if a member of \p name + * is found to be a group, call it \c subgroup_a, H5Giterate() does not + * examine the members of \c subgroup_a. When recursive iteration is + * required, the application must handle the recursion, explicitly + * calling H5Giterate() on discovered subgroups. + + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns number of objects in the group specified by its identifier + * + * \fg_loc_id + * \param[out] num_objs Number of objects in the group + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the function H5Gget_info(). + * + * \details H5Gget_num_objs() returns number of objects in a group. Group is + * specified by its identifier \p loc_id. If a file identifier is + * passed in, then the number of objects in the root group is returned. + * + * \version 1.8.0 Function deprecated in this release. + * + */ +H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns information about an object. + * + * \fgdt_loc_id + * \param[in] name Name of the object for which status is being sought + * \param[in] follow_link Link flag + * \param[out] statbuf Buffer in which to return information about the object + * + * \return \herr_t + * + * \deprecated This function is deprecated in favor of the functions H5Oget_info() + * and H5Lget_info1(). + * + * \details H5Gget_objinfo() returns information about the specified object + * through the \p statbuf argument. + * + * A file or group identifier, \p loc_id, and an object name, \p name, + * relative to \p loc_id, are commonly used to specify the + * object. However, if the object identifier is already known to the + * application, an alternative approach is to use that identifier, \c + * obj_id, in place of \p loc_id, and a dot (\c .) in place of \p + * name. Thus, the alternative versions of the first portion of an + * H5Gget_objinfo() call would be as follows: + * \code + * H5Gget_objinfo (loc_id name ...) + * H5Gget_objinfo (obj_id . ...) + * \endcode + * + * If the object is a symbolic link and follow_link is zero (0), then + * the information returned describes the link itself; otherwise the + * link is followed and the information returned describes the object + * to which the link points. If \p follow_link is non-zero but the + * final symbolic link is dangling (does not point to anything), then + * an error is returned. The \p statbuf fields are undefined for an + * error. The existence of an object can be tested by calling this + * function with a \c NULL \p statbuf. + * + * H5Gget_objinfo() fills in the following data structure (defined in + * H5Gpublic.h): + * \snippet this H5G_stat_t_snip + * + * where \ref H5O_stat_t (defined in H5Opublic.h) is: + * \snippet H5Opublic.h H5O_stat_t_snip + * + * \attention Some systems will be able to record the time accurately but unable + * to retrieve the correct time; such systems (e.g., Irix64) will + * report an \c mtime value of 0 (zero). + * + * \version 1.8.0 Function deprecated in this release. + * \version 1.6.1 Two new fields were added to the \ref H5G_stat_t struct in + * this release. + * + */ +H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, + H5G_stat_t *statbuf /*out*/); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns a name of an object specified by an index + * + * \fg_loc_id + * \param[in] idx Transient index identifying object + * \param[in,out] name Pointer to user-provided buffer the object name + * \param[in] size Name length + * + * \return Returns the size of the object name if successful, or 0 if no name is + * associated with the group identifier. Otherwise returns a negative + * value. + * + * \deprecated This function is deprecated in favor of the function H5Lget_name_by_idx(). + * + * \details H5Gget_objname_by_idx() returns a name of the object specified by + * the index \p idx in the group \p loc_id. + * + * The group is specified by a group identifier \p loc_id. If + * preferred, a file identifier may be passed in \p loc_id; that file's + * root group will be assumed. + * + * \p idx is the transient index used to iterate through the objects in + * the group. The value of \p idx is any nonnegative number less than + * the total number of objects in the group, which is returned by the + * function H5Gget_num_objs(). Note that this is a transient index; an + * object may have a different index each time a group is opened. + * + * The object name is returned in the user-specified buffer \p name. + * + * If the size of the provided buffer \p name is less or equal the + * actual object name length, the object name is truncated to + * \Code{max_size - 1} characters. + * + * Note that if the size of the object's name is unkown, a preliminary + * call to H5Gget_objname_by_idx() with \p name set to \c NULL will + * return the length of the object's name. A second call to + * H5Gget_objname_by_idx() can then be used to retrieve the actual + * name. + * + * \version 1.8.0 Function deprecated in this release. + * \since 1.6.0 + * + */ +H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size); +/** + *------------------------------------------------------------------------- + * \ingroup H5G + * + * \brief Returns the type of an object specified by an index + * + * \fg_loc_id + * \param[in] idx Transient index identifying object + * + * \return Returns the type of the object if successful. Otherwise returns a + * negative value. + * + * \deprecated This function is deprecated in favor of the function H5Oget_info(). + * + * \details H5Gget_objtype_by_idx() returns the type of the object specified by + * the index \p idx in the group \p loc_id. + * + * The group is specified by a group identifier \p loc_id. If + * preferred, a file identifier may be passed in \p loc_id; that file's + * root group will be assumed. + * + * \p idx is the transient index used to iterate through the objects in + * the group. This parameter is described in more detail in the + * discussion of H5Gget_objname_by_idx(). + * + * \version 1.8.0 Function deprecated in this release. + * \version 1.6.0 The function return type changed from \c int to the enumerated + * type \ref H5G_obj_t. + * \since 1.6.0 + * + */ H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index e687e7a..6442a0d 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -32,6 +32,7 @@ * test/tmisc.c to verify that the H5I{inc|dec|get}_ref() routines * work correctly with it. \endinternal */ +//! <!-- [H5I_type_t_snip] --> typedef enum H5I_type_t { H5I_UNINIT = (-2), /**< uninitialized type */ H5I_BADID = (-1), /**< invalid Type */ @@ -52,6 +53,7 @@ typedef enum H5I_type_t { H5I_SPACE_SEL_ITER, /**< type ID for dataspace selection iterator */ H5I_NTYPES /**< number of library types, MUST BE LAST! */ } H5I_type_t; +//! <!-- [H5I_type_t_snip] --> /** * Type of IDs to return to users @@ -85,16 +87,16 @@ typedef herr_t (*H5I_free_t)(void *); /** * The type of a function to compare objects & keys */ -//! [H5I_search_func_t_snip] +//! <!-- [H5I_search_func_t_snip] --> typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key); -//! [H5I_search_func_t_snip] +//! <!-- [H5I_search_func_t_snip] --> /** * The type of H5Iiterate() callback functions */ -//! [H5I_iterate_func_t_snip] +//! <!-- [H5I_iterate_func_t_snip] --> typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); -//! [H5I_iterate_func_t_snip] +//! <!-- [H5I_iterate_func_t_snip] --> #ifdef __cplusplus extern "C" { @@ -112,7 +114,7 @@ extern "C" { * * \return \hid_t{object} * - * \details H5Iregister() allocates and returns a new ID for an object. + * \details H5Iregister() creates and returns a new ID for an object. * * \details The \p type parameter is the identifier for the ID type to which * this new ID will belong. This identifier must have been created by @@ -130,13 +132,13 @@ H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object); * \brief Returns the object referenced by an ID * * \param[in] id ID to be dereferenced - * \param[in] id_type The identifier type + * \param[in] type The identifier type * * \return Pointer to the object referenced by \p id on success, NULL on failure. * * \details H5Iobject_verify() returns a pointer to the memory referenced by id - * after verifying that \p id is of type \p id_type. This function is + * after verifying that \p id is of type \p type. This function is * analogous to dereferencing a pointer in C with type checking. * * \note H5Iobject_verify() does not change the ID it is called on in any way @@ -153,17 +155,17 @@ H5_DLL void *H5Iobject_verify(hid_t id, H5I_type_t type); * \brief Removes an ID from its type * * \param[in] id The ID to be removed from its type - * \param[in] id_type The identifier type + * \param[in] type The identifier type * * \return Returns a pointer to the memory referred to by \p id on success, * NULL on failure. * - * \details H5Iremove_verify() first ensures that \p id belongs to \p id_type. + * \details H5Iremove_verify() first ensures that \p id belongs to \p type. * If so, it removes \p id from its type and returns the pointer * to the memory it referred to. This pointer is the same pointer that * was placed in storage by H5Iregister(). If id does not belong to - * \p id_type, then NULL is returned. + * \p type, then NULL is returned. * * The \p id parameter is the ID which is to be removed from its type. * diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 52c653f..bf1de86 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -92,7 +92,7 @@ typedef enum { /** * \brief Information struct for links */ -//! [H5L_info2_t_snip] +//! <!-- [H5L_info2_t_snip] --> typedef struct { H5L_type_t type; /**< Type of link */ hbool_t corder_valid; /**< Indicate if creation order is valid */ @@ -103,7 +103,7 @@ typedef struct { size_t val_size; /**< Size of a soft link or user-defined link value */ } u; } H5L_info2_t; -//! [H5L_info2_t_snip] +//! <!-- [H5L_info2_t_snip] --> /* The H5L_class_t struct can be used to override the behavior of a * "user-defined" link class. Users should populate the struct with callback @@ -150,7 +150,7 @@ typedef ssize_t (*H5L_query_func_t)(const char *link_name, const void *lnkdata, * "user-defined" link class. Users should populate the struct with callback * functions defined elsewhere. */ -//! [H5L_class_t_snip] +//! <!-- [H5L_class_t_snip] --> typedef struct { int version; /**< Version number of this struct */ H5L_type_t id; /**< Link type ID */ @@ -162,16 +162,16 @@ typedef struct { H5L_delete_func_t del_func; /**< Callback for link deletion */ H5L_query_func_t query_func; /**< Callback for queries */ } H5L_class_t; -//! [H5L_class_t_snip] +//! <!-- [H5L_class_t_snip] --> /** * \brief Prototype for H5Literate2(), H5Literate_by_name2() operator * * The H5O_token_t version is used in the VOL layer and future public API calls. */ -//! [H5L_iterate2_t_snip] +//! <!-- [H5L_iterate2_t_snip] --> typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); -//! [H5L_iterate2_t_snip] +//! <!-- [H5L_iterate2_t_snip] --> /** * \brief Callback for external link traversal @@ -201,8 +201,6 @@ typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lmove() moves a link within an HDF5 file. The original link, * \p src_name, is removed from \p src_loc and the new link, * \p dst_name, is inserted at dst_loc. This change is @@ -321,8 +319,6 @@ H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lcreate_hard() creates a new hard link to a pre-existing object * in an HDF5 file. * @@ -370,8 +366,6 @@ H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lcreate_soft() creates a new soft link to an object in an HDF5 * file. * @@ -434,8 +428,6 @@ H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const c * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Ldelete() removes the link specified by \p name from the location * \p loc_id. * @@ -476,8 +468,6 @@ H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id); * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Ldelete_by_idx() removes the \Emph{n}-th link in a group * according to the specified order, \p order, in the specified index, * \p index. @@ -505,8 +495,6 @@ H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lget_val() returns tha value of link \p name. For smbolic links, * this is the path to which the link points, including the null * terminator. For external and user-defined links, it is the link @@ -564,8 +552,6 @@ H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lget_val_by_idx() retrieves the value of the \Emph{n}-th link in * a group, according to the specified order, \p order, within an * index, \p index. @@ -619,8 +605,6 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lexists() allows an application to determine whether the link \p * name exists in the location specified by \p loc_id. The link may be * of any type; only the presence of a link with that name is checked. @@ -708,8 +692,6 @@ H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id); * * \return \herr_t * - * \todo We need to get the location ID story straight! - * * \details H5Lget_info2() returns information about the specified link through * the \p linfo argument. * @@ -817,8 +799,6 @@ H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, h * * \see H5Lget_info2() * - * \todo Document H5Lget_info_by_idx() - * */ H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo, hid_t lapl_id); @@ -1604,8 +1584,10 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi /* Typedefs */ -/* Information struct for link (for H5Lget_info1/H5Lget_info_by_idx1) */ -//! [H5L_info1_t_snip] +//! <!-- [H5L_info1_t_snip] --> +/** + * Information struct for link (for H5Lget_info1() and H5Lget_info_by_idx1()) + */ typedef struct { H5L_type_t type; /**< Type of link */ hbool_t corder_valid; /**< Indicate if creation order is valid */ @@ -1616,7 +1598,7 @@ typedef struct { size_t val_size; /**< Size of a soft link or UD link value */ } u; } H5L_info1_t; -//! [H5L_info1_t_snip] +//! <!-- [H5L_info1_t_snip] --> /** Callback during link traversal */ typedef hid_t (*H5L_traverse_0_func_t)(const char *link_name, hid_t cur_group, const void *lnkdata, @@ -1636,9 +1618,9 @@ typedef struct { } H5L_class_0_t; /** Prototype for H5Literate1() / H5Literate_by_name1() operator */ -//! [H5L_iterate1_t_snip] +//! <!-- [H5L_iterate1_t_snip] --> typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data); -//! [H5L_iterate1_t_snip] +//! <!-- [H5L_iterate1_t_snip] --> /* Function prototypes */ /** @@ -1656,8 +1638,6 @@ typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_ * \deprecated As of HDF5-1.12 this function has been deprecated in favor of * the function H5Lget_info2() or the macro H5Lget_info(). * - * \todo We need to get the location ID story straight! - * * \details H5Lget_info1() returns information about the specified link through * the \p linfo argument. * diff --git a/src/H5MMpublic.h b/src/H5MMpublic.h index ebfb377..70ac644 100644 --- a/src/H5MMpublic.h +++ b/src/H5MMpublic.h @@ -29,8 +29,13 @@ #include "H5public.h" /* These typedefs are currently used for VL datatype allocation/freeing */ +//! <!-- [H5MM_allocate_t_snip] --> typedef void *(*H5MM_allocate_t)(size_t size, void *alloc_info); +//! <!-- [H5MM_allocate_t_snip] --> + +//! <!-- [H5MM_free_t_snip] --> typedef void (*H5MM_free_t)(void *mem, void *free_info); +//! <!-- [H5MM_free_t_snip] --> #ifdef __cplusplus extern "C" { diff --git a/src/H5Mmodule.h b/src/H5Mmodule.h index 8b4f11f..3dae3e2 100644 --- a/src/H5Mmodule.h +++ b/src/H5Mmodule.h @@ -26,4 +26,49 @@ #define H5_MY_PKG_ERR H5E_MAP #define H5_MY_PKG_INIT YES +/** + * \defgroup H5M H5M + * \brief Map Interface + * + * \details \Bold{The interface can only be used with the HDF5 VOL connectors that + * implement map objects.} The native HDF5 library does not support this + * feature. + * + * While the HDF5 data model is a flexible way to store data, some + * applications require a more general way to index information. HDF5 + * effectively uses key-value stores internally for a variety of + * purposes, but it does not expose a generic key-value store to the + * API. The Map APIs provide this capability to the HDF5 applications + * in the form of HDF5 map objects. These Map objects contain + * application-defined key-value stores, to which key-value pairs can + * be added, and from which values can be retrieved by key. + * + * HDF5 VOL connectors with support for map objects: + * - DAOS + * + * \par Example: + * \code + * hid_t file_id, fapl_id, map_id, vls_type_id; + * const char *names[2] = ["Alice", "Bob"]; + * uint64_t IDs[2] = [25385486, 34873275]; + * uint64_t val_out; + * + * <HDF5 VOL setup code ....> + * + * vls_type_id = H5Tcopy(H5T_C_S1); + * H5Tset_size(vls_type_id, H5T_VARIABLE); + * file_id = H5Fcreate("file.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + * map_id = H5Mcreate(file_id, "map", vls_type_id, H5T_NATIVE_UINT64, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * H5Mput(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &IDs[0], H5P_DEFAULT); + * H5Mput(map_id, vls_type_id, &names[1], H5T_NATIVE_UINT64, &IDs[1], H5P_DEFAULT); + * H5Mget(map_id, vls_type_id, &names[0], H5T_NATIVE_UINT64, &val_out, H5P_DEFAULT); + * if(val_out != IDs[0]) + * ERROR; + * H5Mclose(map_id); + * H5Tclose(vls_type_id); + * H5Fclose(file_id); + * \endcode + * + */ + #endif /* H5Dmodule_H */ diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index 004ff05..f645bc9 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -61,8 +61,12 @@ typedef enum H5VL_map_specific_t { H5VL_MAP_DELETE /* H5Mdelete */ } H5VL_map_specific_t; -/* Callback for H5Miterate() */ +//! <!-- [H5M_iterate_t_snip] --> +/** + * Callback for H5Miterate() + */ typedef herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, void *op_data); +//! <!-- [H5M_iterate_t_snip] --> /********************/ /* Public Variables */ @@ -81,25 +85,359 @@ extern "C" { */ #ifdef H5_HAVE_MAP_API +/** + * \ingroup H5M + * + * \brief Creates a map object + * + * \fgdta_loc_id + * \param[in] name Map object name + * \type_id{key_type_id} + * \type_id{val_type_id} + * \lcpl_id + * \mcpl_id + * \mapl_id + * \returns \hid_t{map object} + * + * \details H5Mcreate() creates a new map object for storing key-value + * pairs. The in-file datatype for keys is defined by \p key_type_id + * and the in-file datatype for values is defined by \p val_type_id. \p + * loc_id specifies the location to create the the map object and \p + * name specifies the name of the link to the map object relative to + * \p loc_id. + * + * \since 1.12.0 + * + */ H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id); + +/** + * \ingroup H5M + * + * \brief + * + * \details + * + * \since 1.12.0 + * + */ H5_DLL hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id, hid_t mapl_id); + +/** + * \ingroup H5M + * + * \brief Opens a map object + * + * \fgdta_loc_id{loc_id} + * \param[in] name Map object name relative to \p loc_id + * \mapl_id + * \returns \hid_t{map object} + * + * \details H5Mopen() finds a map object specified by \p name under the location + * specified by \p loc_id. The map object should be close with + * H5Mclose() when the application is not longer interested in + * accessing it. + * + * \since 1.13.0 + * + */ H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id); + +/** + * \ingroup H5M + * + * \brief Terminates access to a map object + * + * \map_id + * \returns \herr_t + * + * \details H5Mclose() closes access to a map object specified by \p map_id and + * releases resources used by it. + * + * It is illegal to subsequently use that same map identifier in calls + * to other map functions. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Mclose(hid_t map_id); -H5_DLL hid_t H5Mget_key_type(hid_t map_id); -H5_DLL hid_t H5Mget_val_type(hid_t map_id); -H5_DLL hid_t H5Mget_create_plist(hid_t map_id); -H5_DLL hid_t H5Mget_access_plist(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets key datatype for a map object + * + * \map_id + * \returns \hid_t{datatype} + * + * \details H5Mget_key_type() retrieves key datatype as stored in the file for a + * map object specified by \p map_id and returns identifier for the + * datatype. + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Mget_key_type(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets value datatype for a map object + * + * \map_id + * \returns \hid_t{datatype} + * + * \details H5Mget_val_type() retrieves value datatype as stored in the file for + * a map object specified by \p map_id and returns identifier for the + * datatype . + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Mget_val_type(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets creation property list for a map object + * + * \map_id + * \returns \hid_t{map creation property list} + * + * \details H5Mget_create_plist() returns an identifier for a copy of the + * creation property list for a map object specified by \p map_id. + * + * \since 1.13.0 + * + */ +H5_DLL hid_t H5Mget_create_plist(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Gets access property list for a map object + * + * \map_id + * \returns \hid_t{map access property list} + * + * \details H5Mget_access_plist() returns an identifier for a copy of the access + * property list for a map object specified by \p map_id. + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Mget_access_plist(hid_t map_id); + +/** + * \ingroup H5M + * + * \brief Retrieves the number of key-value pairs in a map object + * + * \map_id + * \param[out] count The number of key-value pairs stored in the map object + * \dxpl_id + * \returns \herr_t + * + * \details H5Mget_count() retrieves the number of key-value pairs stored in a + * map specified by map_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Adds a key-value pair to a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \type_id{val_mem_type_id} + * \param[in] value Pointer to value buffer + * \dxpl_id + * \returns \herr_t + * + * \details H5Mput() adds a key-value pair to a map object specified by \p + * map_id, or updates the value for the specified key if one was set + * previously. + * + * \p key_mem_type_id and \p val_mem_type_id specify the datatypes for + * the provided key and value buffers, and if different from those used + * to create the map object, the key and value will be internally + * converted to the datatypes for the map object. + * + * Any further options can be specified through the property list + * \p dxpl_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Retrieves a key-value pair from a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \type_id{val_mem_type_id} + * \param[out] value Pointer to value buffer + * \dxpl_id + * \returns \herr_t + * + * \details H5Mget() retrieves from a map object specified by \p map_id, the + * value associated with the provided key \p key. \p key_mem_type_id + * and \p val_mem_type_id specify the datatypes for the provided key + * and value buffers. If if the datatype specified by \p + * key_mem_type_id is different from that used to create the map object + * the key will be internally converted to the datatype for the map + * object for the query, and if the datatype specified by \p + * val_mem_type_id is different from that used to create the map object + * the returned value will be converted to have a datatype as specified + * by \p val_mem_type_id before the function returns. + * + * Any further options can be specified through the property list + * \p dxpl_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Checks if provided key exists in a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \param[out] exists Pointer to a buffer to return the existence status + * \dxpl_id + * \returns \herr_t + * + * \details H5Mexists() checks if the provided key is stored in the map object + * specified by \p map_id. If \p key_mem_type_id is different from that + * used to create the map object the key will be internally converted + * to the datatype for the map object for the query. + * + * Any further options can be specified through the property list + * \p dxpl_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Iterates over all key-value pairs in a map object + * + * \map_id + * \param[in,out] idx iteration index + * \type_id{key_mem_type_id} + * \param[in] op User-defined iterator function + * \op_data + * \dxpl_id + * \returns \herr_t + * + * \details H5Miterate() iterates over all key-value pairs stored in the map + * object specified by \p map_id, making the callback specified by \p + * op for each. The \p idx parameter is an in/out parameter that may be + * used to restart a previously interrupted iteration. At the start of + * iteration \p idx should be set to 0, and to restart iteration at the + * same location on a subsequent call to H5Miterate(), \p idx should be + * the same value as returned by the previous call. Iterate callback is + * defined as: + * \snippet this H5M_iterate_t_snip + * The \p key parameter is the buffer for the key for this iteration, + * converted to the datatype specified by \p key_mem_type_id. The \p + * op_data parameter is a simple pass through of the value passed to + * H5Miterate(), which can be used to store application-defined data for + * iteration. A negative return value from this function will cause + * H5Miterate() to issue an error, while a positive return value will + * cause H5Miterate() to stop iterating and return this value without + * issuing an error. A return value of zero allows iteration to continue. + * + * Any further options can be specified through the property list \p dxpl_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id); + +/** + * \ingroup H5M + * + * \brief Iterates over all key-value pairs in a map object + * + * \loc_id + * \param[in] map_name Map object name relative to the location specified by \p loc_id + * \param[in,out] idx Iteration index + * \type_id{key_mem_type_id} + * \param[in] op User-defined iterator function + * \op_data + * \dxpl_id + * \lapl_id + * \returns \herr_t + * + * \details H5Miterate_by_name() iterates over all key-value pairs stored in the + * map object specified by \p map_id, making the callback specified by + * \p op for each. The \p idx parameter is an in/out parameter that may + * be used to restart a previously interrupted iteration. At the start + * of iteration \p idx should be set to 0, and to restart iteration at + * the same location on a subsequent call to H5Miterate(), \p idx + * should be the same value as returned by the previous call. Iterate + * callback is defined as: + * \snippet this H5M_iterate_t_snip + * The\p key parameter is the buffer for the key for this iteration, + * converted to the datatype specified by \p key_mem_type_id. The \p + * op_data parameter is a simple pass through of the value passed to + * H5Miterate(), which can be used to store application-defined data + * for iteration. A negative return value from this function will cause + * H5Miterate() to issue an error, while a positive return value will cause + * H5Miterate() to stop iterating and return this value without issuing an + * error. A return value of zero allows iteration to continue. + * + * Any further options can be specified through the property list \p dxpl_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id, hid_t lapl_id); + +/** + * \ingroup H5M + * + * \brief Deletes a key-value pair from a map object + * + * \map_id + * \type_id{key_mem_type_id} + * \param[in] key Pointer to key buffer + * \dxpl_id + * \returns \herr_t + * + * \details H5Mdelete() deletes a key-value pair from the map object specified + * by \p map_id. \p key_mem_type_id specifies the datatype for the + * provided key buffer key, and if different from that used to create + * the map object, the key will be internally converted to the datatype + * for the map object. + * + * Any further options can be specified through the property list \p dxpl_id. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. diff --git a/src/H5Omodule.h b/src/H5Omodule.h index 9ba6c61..134aa92 100644 --- a/src/H5Omodule.h +++ b/src/H5Omodule.h @@ -29,4 +29,10 @@ #define H5_MY_PKG_ERR H5E_OHDR #define H5_MY_PKG_INIT YES +/**\defgroup H5O H5O + * \brief Object Interface + * + * \todo Describe concisely what the functions in this module are about. + * + */ #endif /* H5Omodule_H */ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 9ecfac3..3c44421 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -86,13 +86,15 @@ #define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */ #define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS) -/* Flags for H5Oget_native_info. - * Theses flags determine which fields will be filled in in the H5O_native_info_t - * struct. +//! <!-- [H5O_native_info_fields_snip] --> +/** + * Flags for H5Oget_native_info(). Theses flags determine which fields will be + * filled in in the \ref H5O_native_info_t struct. */ #define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */ #define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ #define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE) +//! <!-- [H5O_native_info_fields_snip] --> /* Convenience macro to check if the token is the 'undefined' token value */ #define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) @@ -101,36 +103,48 @@ /* Public Typedefs */ /*******************/ -/* Types of objects in file */ +//! <!-- [H5O_type_t_snip] --> +/** + * Types of objects in file + */ typedef enum H5O_type_t { - H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ - H5O_TYPE_GROUP, /* Object is a group */ - H5O_TYPE_DATASET, /* Object is a dataset */ - H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ - H5O_TYPE_MAP, /* Object is a map */ - H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ + H5O_TYPE_UNKNOWN = -1, /**< Unknown object type */ + H5O_TYPE_GROUP, /**< Object is a group */ + H5O_TYPE_DATASET, /**< Object is a dataset */ + H5O_TYPE_NAMED_DATATYPE, /**< Object is a named data type */ + H5O_TYPE_MAP, /**< Object is a map */ + H5O_TYPE_NTYPES /**< Number of different object types (must be last!) */ } H5O_type_t; +//! <!-- [H5O_type_t_snip] --> -/* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */ +//! <!-- [H5O_hdr_info_t_snip] --> +/** + * Information struct for object header metadata (for + * H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx()) + */ typedef struct H5O_hdr_info_t { - unsigned version; /* Version number of header format in file */ - unsigned nmesgs; /* Number of object header messages */ - unsigned nchunks; /* Number of object header chunks */ - unsigned flags; /* Object header status flags */ + unsigned version; /**< Version number of header format in file */ + unsigned nmesgs; /**< Number of object header messages */ + unsigned nchunks; /**< Number of object header chunks */ + unsigned flags; /**< Object header status flags */ struct { - hsize_t total; /* Total space for storing object header in file */ - hsize_t meta; /* Space within header for object header metadata information */ - hsize_t mesg; /* Space within header for actual message information */ - hsize_t free; /* Free space within object header */ + hsize_t total; /**< Total space for storing object header in file */ + hsize_t meta; /**< Space within header for object header metadata information */ + hsize_t mesg; /**< Space within header for actual message information */ + hsize_t free; /**< Free space within object header */ } space; struct { - uint64_t present; /* Flags to indicate presence of message type in header */ - uint64_t shared; /* Flags to indicate message type is shared in header */ + uint64_t present; /**< Flags to indicate presence of message type in header */ + uint64_t shared; /**< Flags to indicate message type is shared in header */ } mesg; } H5O_hdr_info_t; +//! <!-- [H5O_hdr_info_t_snip] --> -/* Data model information struct for objects */ -/* (For H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx version 3) */ +//! <!-- [H5O_info2_t_snip] --> +/** + * Data model information struct for objects + * (For H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx() version 3) + */ typedef struct H5O_info2_t { unsigned long fileno; /* File number that object is located in */ H5O_token_t token; /* Token representing the object */ @@ -142,34 +156,52 @@ typedef struct H5O_info2_t { time_t btime; /* Birth time */ hsize_t num_attrs; /* # of attributes attached to object */ } H5O_info2_t; +//! <!-- [H5O_info2_t_snip] --> -/* Native file format information struct for objects */ -/* (For H5Oget_native_info / H5Oget_native_info_by_name / H5Oget_native_info_by_idx) */ +//! <!-- [H5O_native_info_t_snip] --> +/** + * Native file format information struct for objects. + * (For H5Oget_native_info(), H5Oget_native_info_by_name(), H5Oget_native_info_by_idx()) + */ typedef struct H5O_native_info_t { - H5O_hdr_info_t hdr; /* Object header information */ + H5O_hdr_info_t hdr; /**< Object header information */ /* Extra metadata storage for obj & attributes */ struct { - H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ - H5_ih_info_t attr; /* v2 B-tree & heap for attributes */ + H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */ } meta_size; } H5O_native_info_t; +//! <!-- [H5O_native_info_t_snip] --> -/* Typedef for message creation indexes */ +/** + * Typedef for message creation indexes + */ typedef uint32_t H5O_msg_crt_idx_t; -/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (version 3) */ +//! <!-- [H5O_iterate2_t_snip] --> +/** + * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (version 3) + */ typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data); +//! <!-- [H5O_iterate2_t_snip] --> +//! <!-- [H5O_mcdt_search_ret_t_snip] --> typedef enum H5O_mcdt_search_ret_t { - H5O_MCDT_SEARCH_ERROR = -1, /* Abort H5Ocopy */ - H5O_MCDT_SEARCH_CONT, /* Continue the global search of all committed datatypes in the destination file */ - H5O_MCDT_SEARCH_STOP /* Stop the search, but continue copying. The committed datatype will be copied but - not merged. */ + H5O_MCDT_SEARCH_ERROR = -1, /**< Abort H5Ocopy */ + H5O_MCDT_SEARCH_CONT, /**< Continue the global search of all committed datatypes in the destination file + */ + H5O_MCDT_SEARCH_STOP /**< Stop the search, but continue copying. The committed datatype will be copied + but not merged. */ } H5O_mcdt_search_ret_t; +//! <!-- [H5O_mcdt_search_ret_t_snip] --> -/* Callback to invoke when completing the search for a matching committed datatype from the committed dtype - * list */ +//! <!-- [H5O_mcdt_search_cb_t_snip] --> +/** + * Callback to invoke when completing the search for a matching committed + * datatype from the committed dtype list + */ typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data); +//! <!-- [H5O_mcdt_search_cb_t_snip] --> /********************/ /* Public Variables */ @@ -182,48 +214,1611 @@ typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data); extern "C" { #endif -H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); -H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, - hsize_t n, hid_t lapl_id); +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Opens an object in an HDF5 file by location identifier and path name. + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Path to the object; relative to \p loc_id + * \lapl_id + * + * \return \hid_tv{object} + * + * \details H5Oopen() opens a group, dataset, or committed (named) datatype + * specified by a location, \p loc_id, and a path name, \p name, in an HDF5 file. + * + * This function opens the object in the same manner as H5Gopen(), H5Topen(), and H5Dopen(). + * However, H5Oopen() does not require the type of object to be known beforehand. + * This can be useful with user-defined links, for instance, when only a path may be known. + * + * H5Oopen() cannot be used to open a dataspace, attribute, property list, or file. + * + * Once an object of unknown type has been opened with H5Oopen(), + * the type of that object can be determined by means of an H5Iget_type() call. + * + * \p loc_id may be a file, group, dataset, named datatype, or attribute. + * If an attribute is specified for \p loc_id then the object where the + * attribute is attached will be accessed. + * + * \p name must be the path to that object relative to \p loc_id. + * + * \p lapl_id is the link access property list associated with the link pointing to + * the object. If default link access properties are appropriate, this can be + * passed in as #H5P_DEFAULT. + * + * When it is no longer needed, the opened object should be closed with + * H5Oclose(), H5Gclose(), H5Tclose(), or H5Dclose(). + * + * \version 1.8.1 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Opens an object in an HDF5 file using its VOL independent token + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] token Object token + * + * \return \hid_ti{object} + * + * \details H5Oopen_by_token() opens an object specified by the object + * identifier, \p loc_id and object token, \p token. + * + * \par Example + * An example snippet from examples/h5_extlink.c: + * \snippet h5_extlink.c H5Open_by_token_snip + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Opens the nth object in a group + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] group_name Name of group, relative to \p loc_id, in which object is located + * \idx_type + * \order + * \param[in] n Object to open + * \lapl_id + * + * \return \hid_tv{object} + * + * \details H5Open_by_idx() opens the nth object in the group specified by \p loc_id + * and \p group_name. + * + * \p loc_id specifies a location identifier. + * \p group_name specifies the group relative to \p loc_id in which the object can be found. + * If \p loc_id fully specifies the group in which the object resides, + * \p group_name can be a dot (.). + * + * The specific object to be opened within the group is specified by the three parameters: + * \p idx_type, \p order and \p n. + * + * \p idx_type specifies the type of index by which objects are ordered. + * Valid index types include the following: + * + * \indexes + * + * \p order specifies the order in which the objects are to be referenced for the purposes + * of this function. Valid orders include the following: + * + * \orders + * + * Note that for #H5_ITER_NATIVE, rather than implying a particular order, + * it instructs the HDF5 library to iterate through the objects in the fastest + * available order, i.e., in a natural order. + * + * \p n specifies the position of the object within the index. Note that this count is + * zero-based; 0 (zero) indicates that the function will return the value of the first object; + * if \p n is 5, the function will return the value of the sixth object; etc. + * + * \p lapl_id specifies the link access property list to be used in accessing the object. + * + * An object opened with this function should be closed when it is no longer needed so that + * resource leaks will not develop. H5Oclose() can be used to close groups, datasets, + * or committed datatypes. + * + * \version 1.8.1 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Determines whether a link resolves to an actual object. + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name The name of the link to check + * \lapl_id + * + * \return Returns a positive value if the object pointed to by + * the \p loc_id and \p name combination exists. + * \return Returns 0 if the object pointed to by + * the \p loc_id and \p name combination does not exist. + * \return Returns a negatvie value when the function fails. + * + * \details H5Oexists_by_name() allows an application to determine whether + * the link \p name in the group or file specified with \p loc_id + * resolves to an HDF5 object to open or if the link dangles. The + * link may be of any type, but hard links will always resolve + * to objects and do not need to be verified. + * + * Note that H5Oexists_by_name() verifies only that the target + * object exists. If \p name includes either a relative path or + * an absolute path to the target link, intermediate steps + * along the path must be verified before the existence of + * the target link can be safely checked. If the path is not + * verified and an intermediate element of the path does not + * exist, H5Oexists_by_name() will fail. The example in the next + * paragraph illustrates one step-by-step method for verifying + * the existence of a link with a relative or absolute path. + * + * \par Example + * Use the following steps to verify the existence of + * the link \c datasetD in the \c group group1/group2/softlink_to_group3/, + * where \c group1 is a member of the group specified by \c loc_id: + * + * \par + * - First use H5Lexists() to verify that a link named \c group1 exists. + * - If \c group1 exists, use H5Oexists_by_name() to verify that the + * link \c group1 resolves to an object. + * - If \c group1 exists, use H5Lexists() again, this time with name + * set to \c group1/group2, to verify that the link \c group2 exists + * in \c group1. + * - If the \c group2 link exists, use H5Oexists_by_name() to verify + * that \c group1/group2 resolves to an object. + * - If \c group2 exists, use H5Lexists() again, this time with name + * set to \c group1/group2/softlink_to_group3, to verify that the + * link \c softlink_to_group3 exists in \c group2. + * - If the \c softlink_to_group3 link exists, use H5Oexists_by_name() + * to verify that \c group1/group2/softlink_to_group3 resolves to + * an object. + * - If \c softlink_to_group3 exists, you can now safely use H5Lexists + * with name set to \c group1/group2/softlink_to_group3/datasetD to + * verify that the target link, \c datasetD, exists. + * - And finally, if the link \c datasetD exists, use H5Oexists_by_name + * to verify that \c group1/group2/softlink_to_group3/datasetD + * resolves to an object. + * + * \par + * If the link to be verified is specified with an absolute path, + * the same approach should be used, but starting with the first + * link in the file’s root group. For instance, if \c datasetD + * were in \c /group1/group2/softlink_to_group3, the first call to + * H5Lexists() would have name set to \c /group1. + * + * \par + * Note that this is an outline and does not include all necessary + * details. Depending on circumstances, for example, an application + * may need to verify the type of an object also. + * + * \warning \Bold{Failure Modes:} + * \warning If \p loc_id and \p name both exist but the combination does not + * resolve to an object, the function will return 0 (zero); + * the function does not fail in this case. + * \warning If either the location or the link specified by the \p loc_id + * and \p name combination does not exist, the function will fail, + * returning a negative value. + * \warning Note that verifying the existence of an object within an HDF5 + * file is a multistep process. An application can be certain the + * object does not exist only if H5Lexists() and H5Oexists_by_name() + * have been used to verify the existence of the links and groups + * in the hierarchy above that object. The example above, in the + * function description, provides a step-by-step description of + * that verification process. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.5 + * + */ H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object specified by an identifier + * + * \fgdta_loc_obj_id{loc_id} + * \param[out] oinfo Buffer in which to return object information + * \param[in] fields Flags specifying the fields to include in \p oinfo + * + * \return \herr_t + * + * \details H5Oget_info3() specifies an object by its identifier, \p loc_id , and + * retrieves the metadata describing that object in \p oinfo , an H5O_info2_t \c struct. + * + * The H5O_info2_t \c struct is defined in H5Opublic.h as follows : + * \snippet this H5O_info2_t_snip + * + * Note the following about H5O_info2_t : + * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime) + * only \c ctime has been implemented. + * - The \c atime value is the last time the object was read or written. + * - The \c mtime value is the last time the raw data in the object was changed. + * - The \c ctime value is the last time the metadata for the object was changed. + * - The \c btime value is the time the object was created. + * + * The H5O_token_t is defined in H5public.h as follows: + * \snippet H5public.h H5O_token_t_snip + * + * The H5O_type_t \c enum indicates the object type and + * is defined in H5Opublic.h as follows: + * \snippet this H5O_type_t_snip + * + * Note that the object retrieved as indicated by \p loc_id + * refers only to the types specified by H5O_type_t. + * + * The \p fields parameter contains flags to determine which fields will be filled in + * the H5O_info2_t \c struct returned in \p oinfo. + * These flags are defined in the H5Opublic.h file: + * + * \obj_info_fields + * + * \par Example + * An example snippet from examples/h5_attribute.c: + * \par + * \snippet h5_attribute.c H5Oget_info3_snip + * + * \note If you are iterating through a lot of different objects to + * retrieve information via the H5Oget_info() family of routines, + * you may see memory building up. This can be due to memory + * allocation for metadata such as object headers and messages + * when the iterated objects are put into the metadata cache. + * \note + * If the memory buildup is not desirable, you can configure a + * smaller cache via H5Fset_mdc_config() or set the file access + * property list via H5Pset_mdc_config(). A smaller sized cache + * will force metadata entries to be evicted from the cache, + * thus freeing the memory associated with the entries. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object, identifying the object by + * location and relative name + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Name of group, relative to \p loc_id + * \param[out] oinfo Buffer in which to return object information + * \param[in] fields Flags specifying the fields to include in \p oinfo + * \lapl_id + * + * \return \herr_t + * + * \details H5Oget_info_by_name3() specifies an object’s location and name, + * \p loc_id and \p name, respectively, and retrieves the metadata + * describing that object in \p oinfo, an H5O_info2_t struct. + * + * \p oinfo, in which the object information is returned, is a \c struct of + * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code: + * + * \snippet this H5O_info2_t_snip + * + * Note the following about H5O_info2_t : + * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime) + * only \c ctime has been implemented. + * - The \c atime value is the last time the object was read or written. + * - The \c mtime value is the last time the raw data in the object was changed. + * - The \c ctime value is the last time the metadata for the object was changed. + * - The \c btime value is the time the object was created. + * + * The H5O_token_t is defined in H5public.h as follows: + * \snippet H5public.h H5O_token_t_snip + * + * The H5O_type_t \c enum indicates the object type and + * is defined in H5Opublic.h as follows: + * \snippet this H5O_type_t_snip + * + * Note that the object retrieved as indicated by \p loc_id + * refers only to the types specified by H5O_type_t. + * + * The \p fields parameter contains flags to determine which fields will be filled in + * the H5O_info2_t \c struct returned in \p oinfo. + * These flags are defined in the H5Opublic.h file: + * + * \obj_info_fields + * + * The link access property list, \c lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \par Example + * An example snippet from test/vol.c: + * \snippet vol.c H5Oget_info_by_name3_snip + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object, identifying the object + * by an index position + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] group_name Name of group in which object is located + * \idx_type + * \order + * \param[in] n Position within the index + * \param[out] oinfo Buffer in which to return object information + * \param[in] fields Flags specifying the fields to include in \p oinfo + * \lapl_id + * + * \return \herr_t + * + * \details H5Oget_info_by_idx3() retrieves the metadata describing an + * object in the \c struct \p oinfo, as specified by the location, + * \p loc_id, group name, \p group_name, the index by which objects + * in that group are tracked, \p idx_type, the order by which the + * index is to be traversed, \p order, and an object’s position + * \p n within that index. + * + * If \p loc_id fully specifies the group in which the object resides, + * \p group_name can be a dot (\c .). + * + * \p idx_type is of type #H5_index_t, defined in H5public.h as: + * \snippet H5public.h H5_index_t_snip + * + * \p order is of type #H5_iter_order_t defined in H5public.h as: + * \snippet H5public.h H5_iter_order_t_snip + * + * \p oinfo, in which the object information is returned, is a \c struct of + * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code: + * \snippet this H5O_info2_t_snip + * + * Note the following about H5O_info2_t : + * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime) + * only \c ctime has been implemented. + * - The \c atime value is the last time the object was read or written. + * - The \c mtime value is the last time the raw data in the object was changed. + * - The \c ctime value is the last time the metadata for the object was changed. + * - The \c btime value is the time the object was created. + * + * H5O_token_t is defined in H5public.h as follows: + * \snippet H5public.h H5O_token_t_snip + * + * The #H5O_type_t \c enum indicates the object type and + * is defined in H5Opublic.h as follows: + * \snippet this H5O_type_t_snip + * + * Note that the object retrieved as indicated by \p loc_id + * refers only to the types specified by #H5O_type_t. + * + * The \p fields parameter contains flags to determine which fields will be filled in + * the H5O_info2_t \c struct returned in \p oinfo. + * These flags are defined in the H5Opublic.h file: + * \obj_info_fields + * + * The link access property list, \c lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \par Example + * An example snippet from test/titerate.c: + * \snippet titerate.c H5Oget_info_by_idx3_snip + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, unsigned fields, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieve native file format information about an object + * + * \fgdta_loc_obj_id{loc_id} + * \param[out] oinfo Buffer in which to return native object information + * \param[in] fields Flags to determine which fields in \p oinfo are filled in + * + * \return \herr_t + * + * \details H5Oget_native_info() retrieves the native file format information for an object + * specified by \p loc_id. The information is retrieved into the + * buffer specified by \p oinfo, which is defined as a \c struct of + * type H5O_native_info_t in H5Opublic.h: + * + * \snippet this H5O_native_info_t_snip + * + * The \p fields parameter indicates which fields to fill in + * H5O_native_info_t. Possible values defined in H5Opublic.h are: + * + * \snippet this H5O_native_info_fields_snip + * + * \par Example + * An example snippet from test/tfile.c: + * \par + * \snippet tfile.c H5Oget_native_info_snip + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieve native file format information about an object given its name + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Name of object + * \param[out] oinfo Buffer in which to return native object information + * \param[in] fields Flags to determine which fields in \p oinfo are filled in + * \lapl_id + * + * \return \herr_t + * + * \details H5Oget_native_info_by_name() retrieves the native file format information for an object + * specified by \p loc_id and the name \p name. The information is + * retrieved into the buffer specified by \p oinfo, which is defined + * as a \c struct of type H5O_native_info_t in H5Opublic.h: + * + * \snippet this H5O_native_info_t_snip + * + * The \p fields parameter which fields to fill in H5O_native_info_t. + * Possible values defined in H5Opublic.h are: + * + * \snippet this H5O_native_info_fields_snip + * + * \par Example + * An example snippet from test/tfile.c: + * \snippet tfile.c H5Oget_native_info_by_name_snip + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieve native file format information about an object + * according to the order of an index + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] group_name Name of group in which object is located + * \idx_type + * \order + * \param[in] n Position within the index + * \param[out] oinfo Buffer in which to return native object information + * \param[in] fields Flags to determine which fields in \p oinfo are filled in + * \lapl_id + * + * \return \herr_t + * + * \details H5Oget_native_info_by_idx() retrieves the native file format information for an object + * specified by \p loc_id, group name, \p group_name, the index by which + * objects in the group are tracked, \p idx_type, the order by which + * the index is to be traversed, \p order , and an object's position + * \p n within that index. The information is retrieved into the + * buffer specified by \p oinfo, which is defined as a \c struct of + * type H5O_native_info_t in H5Opublic.h: + * \snippet this H5O_native_info_t_snip + * + * \p idx_type is of type #H5_index_t, defined in H5public.h as: + * \snippet H5public.h H5_index_t_snip + * + * \p order is of type #H5_iter_order_t defined in H5public.h as: + * \snippet H5public.h H5_iter_order_t_snip + * + * The \p fields parameter indicates which fields to fill in H5O_native_info_t. + * Possible values defined in H5Opublic.h are: + * \snippet this H5O_native_info_fields_snip + * + * The link access property list, \c lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, unsigned fields, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Creates a hard link to an object in an HDF5 file + * + * \param[in] obj_id Object to be linked + * \param[in] new_loc_id Location identifier at which object is to be linked; + * may be a file, group, dataset, named datatype or attribute identifier. + * \param[in] new_name Name of link to be created, relative to \p new_loc_id. + * \lcpl_id + * \lapl_id + * + * \return \herr_t + * + * \details H5Olink() creates a new hard link to an object in an HDF5 file. + * \p new_loc_id and \p \p new_link_name specify the location and name of the + * new link while \p object_id identifies the object that the link + * points to. + * + * H5Olink() is designed for two purposes: + * - To create the first hard link to an object that has just + * been created with H5Dcreate_anon(), H5Gcreate_anon(), or + * H5Tcommit_anon(). + * - To add additional structure to an existing + * file so that, for example, an object can be shared among + * multiple groups. + * + * \p lcpl and \p lapl are the link creation and access property lists + * associated with the new link. + * + * \par Example: + * To create a new link to an object while simultaneously creating + * missing intermediate groups: Suppose that an application must + * create the group C with the path /A/B01/C but may not know + * at run time whether the groups A and B01 exist. The following + * code ensures that those groups are created if they are missing: + * \par + * \code + * + * // Creates a link creation property list (LCPL). + * hid_t lcpl_id = H5Pcreate(H5P_LINK_CREATE); + * + * // Sets "create missing intermediate groups" property in that LCPL. + * int status = H5Pset_create_intermediate_group(lcpl_id, TRUE); + * + * // Creates a group without linking it into the file structure. + * hid_t gid = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT); + * + * // Links group into file structure. + * status = H5Olink(gid, file_id, "/A/B01/C", lcpl_id, H5P_DEFAULT); + * + * \endcode + * + * \par + * Note that unless the object is intended to be temporary, + * the H5O_LINK call is mandatory if an object created with one + * of the H5*_CREATE_ANON functions (or with H5T_COMMIT_ANON) + * is to be retained in the file; without an H5O_LINK call, + * the object will not be linked into the HDF5 file structure + * and will be deleted when the file is closed. + * + * \version 1.8.1 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Increments an object reference count + * + * \fgdta_loc_obj_id{object_id} + * + * \return \herr_t + * + * \details H5Oincr_refcount() increments the hard link reference count for an object. + * It should be used any time a user-defined link that references + * an object by address is added. When the link is deleted, + * H5Odecr_refcount() should be used. + * + * An object’s reference count is the number of hard links in the + * file that point to that object. See the “Programming Model” + * section of the HDF5 Groups chapter in the -- <em>HDF5 User’s Guide</em> + * for a more complete discussion of reference counts. + * + * If a user application needs to determine an object’s reference + * count, an H5Oget_info() call is required; the reference count + * is returned in the \c rc field of the #H5O_info_t \c struct. + * + * \warning This function must be used with care! + * \warning Improper use can lead to inaccessible data, wasted space in the file, + * or <b><em>file corruption</em></b>. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Oincr_refcount(hid_t object_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Decrements an object reference count + * + * \fgdta_loc_obj_id{object_id} + * + * \return \herr_t + * + * \details H5Odecr_refcount() decrements the hard link reference count for an object. + * It should be used any time a user-defined link that references + * an object by address is deleted. In general, H5Oincr_refcount() will have + * been used previously, when the link was created. + * + * An object’s reference count is the number of hard links in the + * file that point to that object. See the “Programming Model” + * section of the HDF5 Groups chapter in the <em>HDF5 User’s Guide</em> + * for a more complete discussion of reference counts. + * + * If a user application needs to determine an object’s reference + * count, an H5Oget_info() call is required; the reference count + * is returned in the \c rc field of the #H5O_info_t \c struct. + * + * \warning This function must be used with care! + * \warning Improper use can lead to inaccessible data, wasted space in the file, + * or <b><em>file corruption</em></b>. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Odecr_refcount(hid_t object_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Copies an object in an HDF5 file + * + * \param[in] src_loc_id Object identifier indicating the location of the + * source object to be copied + * \param[in] src_name Name of the source object to be copied + * \param[in] dst_loc_id Location identifier specifying the destination + * \param[in] dst_name Name to be assigned to the new copy + * \param[in] ocpypl_id Object copy property list + * \lcpl_id + * + * \return \herr_t + * + * \details H5Ocopy() copies the group, dataset or committed datatype + * specified by \p src_name from the file or group specified by + * \p src_loc_id to the destination location \p dst_loc_id. + * + * The destination location, as specified in dst_loc_id, may + * be a group in the current file or a location in a different + * file. If dst_loc_id is a file identifier, the copy will be + * placed in that file’s root group. + * + * The copy will be created with the path specified in \p dst_name, + * which must not pre-exist in the destination location. If + * \p dst_name already exists at the location \p dst_loc_id, + * H5Ocopy() will fail. If \p dst_name is an absolute path, + * the copy will be created relative to the file’s root group. + * + * The copy of the object is created with the property lists + * specified by \p ocpypl_id and \p lcpl_id. #H5P_DEFAULT can be passed + * in for these property lists. The default behavior: + * + * - of the link creation property list is to NOT create + * intermediate groups. + * - of the flags specified by the object creation property list + * is described in H5Pset_copy_object(). + * + * These property lists or flags can be modified to govern the + * behavior of H5Ocopy() as follows: + * + * - A flag controlling the creation of intermediate groups that + * may not yet exist is set in the link creation property list + * \p lcpl_id with H5Pset_create_intermediate_group(). + * + * - Copying of committed datatypes can be tuned through the use + * of H5Pset_copy_object(), H5Padd_merge_committed_dtype_path(), + * H5Pset_mcdt_search_cb(), and related functions. + * + * - Flags controlling other aspects of object copying are set in the + * object copy property list \p ocpypl_id with H5Pset_copy_object(). + * + * H5Ocopy() will always try to make a copy of the object specified + * in \p src_name. + * + * - If the object specified by \p src_name is a group containing a + * soft or external link, the default is that the new copy will + * contain a soft or external link with the same value as the + * original. See H5Pset_copy_object() for optional settings. + * + * - If the path specified in \p src_name is or contains a soft link + * or an external link, H5Ocopy() will copy the target object. + * Use H5Lcopy() if the intent is to create a new soft or external + * link with the same value as the original link. + * + * H5Ocopy() can be used to copy an object in an HDF5 file. If + * an object has been changed since it was opened, it should be + * written back to the file before using H5Ocopy(). The object + * can be written back either by closing the object (H5Gclose(), + * H5Oclose(), H5Dclose(), or H5Tclose()) or by flushing + * the HDF5 file (H5Fflush()). + * + * \par See Also: + * - Functions to modify the behavior of H5Ocopy(): + * - H5Padd_merge_committed_dtype_path() + * - H5Pset_copy_object() + * - H5Pset_create_intermediate_group() + * - H5Pset_mcdt_search_cb() + * - Copying Committed Datatypes with #H5Ocopy - A comprehensive + * discussion of copying committed datatypes (PDF) in + * Advanced Topics in HDF5 + * + * \version 1.8.9 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Sets comment for specified object + * + * \fgdta_loc_obj_id{obj_id} + * \param[in] comment The new comment + * + * \return \herr_t + * + * \details H5Oset_comment() sets the comment for the specified object + * to the contents of \p comment. Any previously existing comment + * is overwritten. + * + * The target object is specified by an identifier, \p obj_id. + * If \p comment is the empty string or a null pointer, any existing + * comment message is removed from the object. + * + * Comments should be relatively short, null-terminated, ASCII strings. + * + * Comments can be attached to any object that has an object + * header. Datasets, groups, and committed (named) datatypes have + * object headers. Symbolic links do not have object headers. + * + * If a comment is being added to an object attribute, this comment + * will be attached to the object to which the attribute belongs + * and not to the attribute itself. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Oset_comment(hid_t obj_id, const char *comment); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Sets comment for specified object + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Name of the object whose comment is to be set or reset + * \param[in] comment The new comment + * \lapl_id + * + * \return \herr_t + * + * \details H5Oset_comment_by_name() sets the comment for the specified object + * to the contents of \p comment. Any previously existing comment + * is overwritten. + * + * The target object is specified by \p loc_id and \p name. + * \p loc_id can specify any object in the file. + * \p name can be one of the following: + * + * - The name of the object specified as a path relative to \p loc_id + * - An absolute name of the object, starting from \c /, the file’s root group + * - A dot (\c .), if \p loc_id fully specifies the object + * + * If \p comment is the empty string or a null pointer, any existing + * comment message is removed from the object. + * + * Comments should be relatively short, null-terminated, ASCII strings. + * + * Comments can be attached to any object that has an object + * header. Datasets, groups, and committed (named) datatypes have + * object headers. Symbolic links do not have object headers. + * + * If a comment is being added to an object attribute, this comment + * will be attached to the object to which the attribute belongs + * and not to the attribute itself. + * + * \p lapl_id contains a link access property list identifier. A + * link access property list can come into play when traversing + * links to access an object. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves comment for specified object + * + * \fgdta_loc_obj_id{obj_id} + * \param[out] comment The comment + * \param[in] bufsize Anticipated required size of the comment buffer + * + * \return Upon success, returns the number of characters in the + * comment, not including the \c NULL terminator, or zero (\c 0) if + * the object has no comment. The value returned may be larger + * than \p bufsize. Otherwise returns a negative value. + * + * \details H5Oget_comment() retrieves the comment for the specified object in + * the buffer \p comment. + * + * The target object is specified by an identifier, \p object_id. + * + * The size in bytes of the buffer \p comment, including the \c NULL + * terminator, is specified in \p bufsize. If \p bufsize is unknown, + * a preliminary H5Oget_comment() call with the pointer \p comment + * set to \c NULL will return the size of the comment <em>without</em> + * the \c NULL terminator. + * + * If \p bufsize is set to a smaller value than described above, + * only \p bufsize bytes of the comment, without a \c NULL terminator, + * are returned in \p comment. + * + * If an object does not have a comment, the empty string is + * returned in \p comment. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves comment for specified object + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Name of the object whose comment is to be retrieved + * \param[out] comment The comment + * \param[in] bufsize Anticipated required size of the \p comment buffer + * \lapl_id + * + * \return Upon success, returns the number of characters in the comment, + * not including the \c NULL terminator, or zero (\c 0) if the object + * has no comment. The value returned may be larger than \c bufsize. + * Otherwise returns a negative value. + * + * \details H5Oget_comment_by_name() retrieves the comment for an object + * in the buffer \p comment. + * + * The target object is specified by \p loc_id and \p name. + * \p loc_id can specify any object in the file. + * \p name can be one of the following: + * + * - The name of the object relative to \p loc_id + * - An absolute name of the object, starting from \c /, the file’s root group + * - A dot (\c .), if \p loc_id fully specifies the object + * + * The size in bytes of the comment, including the \c NULL terminator, + * is specified in \p bufsize. If \p bufsize is unknown, a preliminary + * H5Oget_comment_by_name() call with the pointer \p comment set + * to \c NULL will return the size of the comment <em>without</em> + * the \c NULL terminator. + * + * If \p bufsize is set to a smaller value than described above, + * only \p bufsize bytes of the comment, without a \c NULL terminator, + * are returned in \p comment. + * + * If an object does not have a comment, the empty string is + * returned in \p comment. + * + * \p lapl_id contains a link access property list identifier. A + * link access property list can come into play when traversing + * links to access an object. + * + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id); -H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, - void *op_data, unsigned fields); -H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, - hid_t lapl_id); -H5_DLL herr_t H5Oclose(hid_t object_id); -H5_DLL herr_t H5Oflush(hid_t obj_id); -H5_DLL herr_t H5Orefresh(hid_t oid); -H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); -H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); -H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); -H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, - int *cmp_value); -H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str); -H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Recursively visits all objects accessible from a specified object + * + * \fgdta_loc_obj_id{obj_id} + * \idx_type + * \order + * \param[in] op Callback function passing data regarding the object + * to the calling application + * \param[in] op_data User-defined pointer to data required by the application + * for its processing of the object + * \param[in] fields Flags specifying the fields to be retrieved to the + * callback \p op + * + * \return On success, returns the return value of the first operator + * that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * \return On failure, returns a negative value if something goes wrong + * within the library, or the first negative value returned by + * an operator. + * + * \details H5Ovisit3() is a recursive iteration function to visit the + * object \p obj_id and, if \p obj_id is a group, all objects in + * and below it in an HDF5 file, thus providing a mechanism for + * an application to perform a common set of operations across + * all of those objects or a dynamically selected subset. + * For non-recursive iteration across the members of a group, + * see H5Literate2(). + * + * If \p obj_id is a group identifier, that group serves as the + * root of a recursive iteration. If \p obj_id is a file identifier, + * that file’s root group serves as the root of the recursive + * iteration. If \p obj_id is an attribute identifier, + * then the object where the attribute is attached will be iterated. + * If \p obj_id is any other type of object, such as a dataset or + * named datatype, there is no iteration. + * + * Two parameters are used to establish the iteration: \p idx_type + * and \p order. + * + * \p idx_type specifies the index to be used. If the links in + * a group have not been indexed by the index type, they will + * first be sorted by that index then the iteration will begin; + * if the links have been so indexed, the sorting step will be + * unnecessary, so the iteration may begin more quickly. Valid + * values include the following: + * + * \indexes + * + * Note that the index type passed in \p idx_type is a + * <em>best effort</em> setting. If the application passes in + * a value indicating iteration in creation order and a group is + * encountered that was not tracked in creation order, that group + * will be iterated over in alpha-numeric order by name, or + * <em>name order</em>. (<em>Name order</em> is the native order + * used by the HDF5 library and is always available.) + * + * \p order specifies the order in which objects are to be inspected + * along the index specified in \p idx_type. Valid values include + * the following: + * + * \orders + * + * The prototype of the callback function op is as follows (as + * defined in the source code file H5Opublic.h): + * + * \snippet this H5O_iterate2_t_snip + * + * The parameters of this callback function have the following values + * or meanings: + * <table> + * <tr> + * <td>\c obj</td> + * <td>Object that serves as root of the iteration; + * same value as the H5Ovisit() \p obj_id parameter</td> + * </tr> + * <tr> + * <td>\c name</td> + * <td>Name of object, relative to \c obj, being examined at + * current step of the iteration</td> + * </tr> + * <tr> + * <td>\c info</td> + * <td>H5O_info2_t \c struct containing information + * regarding that object</td> + * </tr> + * <tr> + * <td>\c op_data</td> + * <td>User-defined pointer to data required by the application in + * processing the object; a pass-through of the \c op_data pointer + * provided with the H5Ovisit() function call</td> + * </tr> + * </table> + * + * The H5O_info2_t \c struct is defined in H5Opublic.h as follows: + * \snippet this H5O_info2_t_snip + * + * H5O_token_t is defined in H5public.h as follows: + * \snippet H5public.h H5O_token_t_snip + * + * The #H5O_type_t enum indicates the object type and is + * defined in H5Opublic.h as follows: + * \snippet this H5O_type_t_snip + * + * Note that the object retrieved as indicated by \p obj_id + * refers only to the types specified by #H5O_type_t. + * + * The return values from an operator are: + * - Zero causes the visit iterator to continue, returning zero when all + * group members have been processed. + * - A positive value causes the visit iterator to immediately return that + * positive value, indicating short-circuit success. + * - A negative value causes the visit iterator to immediately return that + * value, indicating failure. + * + * The H5Ovisit3() \p op_data parameter is a user-defined pointer to the data + * required to process objects in the course of the iteration. This pointer + * is passed back to each step of the iteration in the callback + * function’s \p op_data parameter. + * + * The \p fields parameter contains flags to determine which fields will + * be retrieved by the \p op callback function. These flags are defined + * in the H5Opublic.h file: + * \obj_info_fields + * + * H5Lvisit2() and H5Ovisit3() are companion functions: one for + * examining and operating on links; the other for examining + * and operating on the objects that those links point to. Both + * functions ensure that by the time the function completes + * successfully, every link or object below the specified point + * in the file has been presented to the application for whatever + * processing the application requires. These functions assume + * that the membership of the group being iterated over remains + * unchanged through the iteration; if any of the links in the + * group change during the iteration, the resulting behavior + * is undefined. + * + * \note \Bold{Programming Note for C++ Developers Using C Functions:} + * \note 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. + * + * \note 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(). + * + * \note 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++ + * “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. + * + * \par Example + * An example snippet from test/links.c: + * \snippet links.c H5Ovisit3_snip + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, + void *op_data, unsigned fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Recursively visits all objects accessible from a specified object + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] obj_name Name of the object, generally relative to + * \p loc_id, that will serve as root of the iteration + * \idx_type + * \order + * \param[in] op Callback function passing data regarding the object + * to the calling application + * \param[in] op_data User-defined pointer to data required by the application + * for its processing of the object + * \param[in] fields Flags specifying the fields to be retrieved to the + * callback function \p op + * \lapl_id + * + * \return On success, returns the return value of the first operator + * that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * \return On failure, returns a negative value if something goes wrong + * within the library, or the first negative value returned by + * an operator. + * + * \details H5Ovisit_by_name3() is a recursive iteration function to visit + * the object specified by the \p loc_id / \p obj_name parameter + * pair and, if that object is a group, all objects in and below it + * in an HDF5 file, thus providing a mechanism for an application to + * perform a common set of operations across all of those objects or + * a dynamically selected subset. For non-recursive iteration across + * the members of a group, see H5Literate2(). + * + * The object serving as the root of the iteration is specified + * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies + * a file or an object in a file; if \p loc_id is an attribute identifier, + * the object where the attribute is attached will be used. + * \p obj_name specifies either an object in the file (with an absolute + * name based in the file’s root group) or an object name relative + * to \p loc_id. If \p loc_id fully specifies the object that is to serve + * as the root of the iteration, \p obj_name should be '\c .' (a dot). + * (Note that when \p loc_id fully specifies the object that is to serve + * as the root of the iteration, the user may wish to consider + * using H5Ovisit3() instead of H5Ovisit_by_name3().) + * + * Two parameters are used to establish the iteration: \p idx_type + * and \p order. + * + * \p idx_type specifies the index to be used. If the links in + * a group have not been indexed by the index type, they will + * first be sorted by that index then the iteration will begin; + * if the links have been so indexed, the sorting step will be + * unnecessary, so the iteration may begin more quickly. Valid + * values include the following: + * + * \indexes + * + * Note that the index type passed in \p idx_type is a + * <em>best effort</em> setting. If the application passes in a + * value indicating iteration in creation order and a group is + * encountered that was not tracked in creation order, that group + * will be iterated over in alpha-numeric order by name, or + * <em>name order</em>. (<em>Name order</em> is the native order + * used by the HDF5 library and is always available.) + * + * \p order specifies the order in which objects are to be inspected + * along the index specified in \p idx_type. Valid values include + * the following: + * + * \orders + * + * The prototype of the callback function op is as follows (as + * defined in the source code file H5Opublic.h): + * + * \snippet this H5O_iterate2_t_snip + * + * The parameters of this callback function have the following + * values or meanings: + * <table> + * <tr> + * <td>\c obj</td> + * <td>Object that serves as root of the iteration</td> + * </tr> + * <tr> + * <td>\c name</td> + * <td>Name of object, relative to \c obj, being examined at + * current step of the iteration</td> + * </tr> + * <tr> + * <td>\c info</td> + * <td>H5O_info2_t \c struct containing information + * regarding that object</td> + * </tr> + * <tr> + * <td>\c op_data</td> + * <td>User-defined pointer to data required by the application in + * processing the object</td> + * </tr> + * </table> + * + * The H5O_info2_t \c struct is defined in H5Opublic.h as follows: + * \snippet this H5O_info2_t_snip + * + * H5O_token_t is defined in H5public.h as follows: + * \snippet H5public.h H5O_token_t_snip + * + * The #H5O_type_t enum indicates the object type and is + * defined in H5Opublic.h as follows: + * \snippet this H5O_type_t_snip + * + * The H5Ovisit_by_name3() \p op_data parameter is a user-defined + * pointer to the data required to process objects in the course + * of the iteration. This pointer is passed back to each step of + * the iteration in the callback function’s \p op_data parameter. + * + * \p lapl_id is a link access property list. In the general case, + * when default link access properties are acceptable, this can + * be passed in as #H5P_DEFAULT. An example of a situation that + * requires a non-default link access property list is when + * the link is an external link; an external link may require + * that a link prefix be set in a link access property list + * (see H5Pset_elink_prefix()). + * + * The \p fields parameter contains flags to determine which fields will + * be retrieved by the \p op callback function. These flags are defined + * in the H5Opublic.h file: + * \obj_info_fields + * + * H5Lvisit_by_name2() and H5Ovisit_by_name3() are companion + * functions: one for examining and operating on links; the other + * for examining and operating on the objects that those links point to. + * Both functions ensure that by the time the function completes + * successfully, every link or object below the specified point + * in the file has been presented to the application for whatever + * processing the application requires. + * + * \note \Bold{Programming Note for C++ Developers Using C Functions:} + * \note 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. + * + * \note 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(). + * + * \note 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++ + * “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. + * + * \par Example + * An example snippet from test/links.c: + * \snippet links.c H5Ovisit_by_name3_snip + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, + hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Closes an object in an HDF5 file + * + * \obj_id{object_id} + * + * \return \herr_t + * + * \details H5Oclose() closes the group, dataset, or named datatype specified by + * object_id. + * + * This function is the companion to H5Oopen(), and has the same + * effect as calling H5Gclose(), H5Dclose(), or H5Tclose(). + * + * H5Oclose() is not used to close a dataspace, attribute, property + * list, or file. + * + * \version 1.8.8 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Oclose(hid_t object_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Flushes all buffers associated with an HDF5 object to disk + * + * \fgdta_loc_obj_id{obj_id} + * + * \return \herr_t + * + * \details H5Oflush() causes all buffers associated with an object to be immediately + * flushed to disk without removing the data from the cache. + * + * The object associated with \p object_id can be any named object in an + * HDF5 file including a dataset, a group, or a committed datatype. + * + * \note HDF5 does not possess full control over buffering. H5Oflush() + * flushes the internal HDF5 buffers and then asks the operating + * system (the OS) to flush the system buffers for the open + * files. After that, the OS is responsible for ensuring that + * the data is actually flushed to disk. + * + * \par See Also: + * - H5Dflush() + * - H5Drefresh() + * - H5Oflush() + * - H5Grefresh() + * - H5Oflush() + * - H5Orefresh() + * - H5Tflush() + * - H5Trefresh() + * \par + * - \c H5DOappend() + * - H5Fstart_swmr_write() + * - H5Pget_append_flush() + * - H5Pget_object_flush_cb() + * - H5Pset_append_flush() + * - H5Pset_object_flush_cb() + * \par + * - H5Oare_mdc_flushes_disabled() + * - H5Odisable_mdc_flushes() + * - H5Oenable_mdc_flushes() + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Oflush(hid_t obj_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Refreshes all buffers associated with an HDF5 object + * + * \fgdta_loc_obj_id{oid} + * + * \return \herr_t + * + * \details H5Orefresh() causes all buffers associated with an object to be cleared + * and immediately re-loaded with updated contents from disk. + * + * This function essentially closes the object, evicts all + * metadata associated with it from the cache, and then re-opens + * the object. The reopened object is automatically re-registered + * with the same identifier. + * + * The object associated with \p oid can be any named object in an + * HDF5 file including a dataset, a group, or a committed datatype. + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Orefresh(hid_t oid); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Prevents metadata entries for an HDF5 object from being flushed + * from the metadata cache to storage + * + * \param[in] object_id Identifier of the object that will have flushes disabled; + * may be a group, named datatype, or dataset identifier + * + * \return \herr_t + * + * \details H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes() and associated flush + * functions can be used to control the flushing of entries from + * a file’s metadata cache. + * + * This function prevents an object’s or cache’s dirty metadata + * entries from being flushed from the cache by the usual cache + * eviction/flush policy. Instead, users must manually flush the + * cache or entries for individual objects via the appropriate + * H5Fflush(), H5Dflush(), H5Gflush(), H5Tflush(), and H5Oflush() calls. + * + * Metadata cache entries can be controlled at both the individual + * HDF5 object level (datasets, groups, committed datatypes) + * and the entire metadata cache level. + * + * \note HDF5 objects include datasets, groups, and committed datatypes. + * Only #hid_t identifiers that represent these objects can be passed to the function. + * \note Passing in a #hid_t identifier that represents any other HDF5 entity is + * considered an error. + * \note It is an error to pass an HDF5 file identifier + * (obtained from H5Fopen() or H5Fcreate()) + * to this function. + * \note Misuse of this function can cause the cache to exhaust + * available memory. + * \note Objects can be returned to the default automatic flush behavior + * with H5Oenable_mdc_flushes(). + * \note Flush prevention only pertains to new or dirty metadata entries. + * Clean entries can be evicted from the cache. + * \note Calling this function on an object that has already had flushes + * disabled will return an error. + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Enables flushing of dirty metadata entries from a file’s metadata cache + * + * \param[in] object_id Identifier of the object that will have flushes re-enabled; + * may be a group, named datatype, or dataset identifier + * + * \return \herr_t + * + * \details H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() + * and associated flush functions can be used to control the flushing + * of entries from a file’s metadata cache. + * + * This function allows an object or cache’s dirty metadata entries to be + * flushed from the cache by the usual cache eviction/flush policy. + * + * Metadata cache entries can be controlled at both the individual HDF5 + * object level (datasets, groups, committed datatypes) and the entire + * metadata cache level. + * + * + * \note HDF5 objects include datasets, groups, and committed datatypes. + * Only #hid_t identifiers that represent these objects can be + * passed to the function. + * + * \note Passing in a #hid_t identifier that represents any other HDF5 entity + * is considered an error. + * + * \note It is an error to pass an HDF5 file identifier + * (obtained from H5Fopen() or H5Fcreate()) + * to this function. + * + * \note Using this function on an object that has not had flushes disabled + * is considered an error. The state of an object can be determined + * with H5Oare_mdc_flushes_disabled(). + * + * \note An object will be returned to the default flush algorithm when it is closed. + * + * \note All objects will be returned to the default flush algorithm when + * the file is closed. + * + * \note An object’s entries will not necessarily be flushed as a result of + * calling this function. + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves comment for specified object + * + * \param[in] object_id Identifier of an object in the cache; + * may be a group, named datatype, or dataset identifier + * \param[out] are_disabled Flushes enabled/disabled + * + * \return \p are_disabled will be set to \c 1 if an object has had flushes disabled + * and \c 0 if it has not had flushes disabled. + * \return \herr_t + * + * \details H5Oare_mdc_flushes_disabled() determines if an HDF5 object (dataset, group, committed + * datatype) has had flushes of metadata entries disabled. + * + * The H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() and + * associated flush functions can be used to control the flushing of + * entries from a file’s metadata cache. Metadata cache entries can be controlled + * at both the individual HDF5 object level (datasets, groups, + * committed datatypes) and the entire metadata cache level. + * + * \note HDF5 objects include datasets, groups, and committed datatypes. + * Only #hid_t identifiers that represent these objects can be passed to the function. + * \note Passing in a #hid_t identifier that represents any other HDF5 entity is + * considered an error. + * \note It is an error to pass an HDF5 file identifier + * (obtained from H5Fopen() or H5Fcreate()) to this function. + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Compares two VOL connector object tokens + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] token1 First object token + * \param[in] token2 Second object token + * \param[out] cmp_value Comparison value + * + * \return \herr_t + * + * \details H5Otoken_cmp() compares two VOL connector object tokens, \p token1 + * and \p token2 for the file or group identifier specified by \p loc_id. + * Both object tokens must be from the same VOL connector class. + * + * H5O_token_t is defined in H5public.h as follows: + * \snippet H5public.h H5O_token_t_snip + * + * A comparison value, \p cmp_value, is returned, which indicates the + * result of the comparison: + * + * <table> + * <tr> + * <th>cmp_value</th> + * <th>Result</th> + * </tr> + * <tr> + * <td> > 0</td> + * <td> \p token1 > \p token2</td> + * </tr> + * <tr> + * <td> < 0</td> + * <td>\p token1 < \p token2</td> + * </tr> + * <tr> + * <td>0</td> + * <td>\p token1 = \p token2</td> + * </tr> + * </table> + * + * \par Example + * An example snippet from test/links.c: + * \snippet links.c H5Otoken_cmp_snip + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + int *cmp_value); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Serializes a connector's object token into a string + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] token Connector object token + * \param[out] token_str String for connector object token \p token + * + * \return \herr_t + * + * \details H5Otoken_to_str() serializes a connector's object token specified by + * \p token and the location identifier for the object, \p loc_id, + * into a string, \p token_str. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Deserializes a string into a connector object token + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] token_str Object token string + * \param[out] token Connector object token + * + * \return \herr_t + * + * \details H5Otoken_from_str() deserializes a string, \p token_str, into a + * connector object token, \p token, for the object specified by the + * location identifier, \p loc_id. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token); /* The canonical 'undefined' token value */ #define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g) @@ -245,55 +1840,978 @@ H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g; /* Typedefs */ -/* A struct that's part of the H5G_stat_t structure (deprecated) */ +//! <!-- [H5O_stat_t_snip] --> +/** + * A struct that's part of the \ref H5G_stat_t structure + * \deprecated + */ typedef struct H5O_stat_t { - hsize_t size; /* Total size of object header in file */ - hsize_t free; /* Free space within object header */ - unsigned nmesgs; /* Number of object header messages */ - unsigned nchunks; /* Number of object header chunks */ + hsize_t size; /**< Total size of object header in file */ + hsize_t free; /**< Free space within object header */ + unsigned nmesgs; /**< Number of object header messages */ + unsigned nchunks; /**< Number of object header chunks */ } H5O_stat_t; +//! <!-- [H5O_stat_t_snip] --> -/* Information struct for object */ -/* (For H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx versions 1 & 2) */ +//! <!-- [H5O_info1_t_snip] --> +/** + * Information struct for object (For H5Oget_info(), H5Oget_info_by_name(), + * H5Oget_info_by_idx() versions 1 & 2.) + */ typedef struct H5O_info1_t { - unsigned long fileno; /* File number that object is located in */ - haddr_t addr; /* Object address in file */ - H5O_type_t type; /* Basic object type (group, dataset, etc.) */ - unsigned rc; /* Reference count of object */ - time_t atime; /* Access time */ - time_t mtime; /* Modification time */ - time_t ctime; /* Change time */ - time_t btime; /* Birth time */ - hsize_t num_attrs; /* # of attributes attached to object */ - H5O_hdr_info_t hdr; /* Object header information */ + unsigned long fileno; /**< File number that object is located in */ + haddr_t addr; /**< Object address in file */ + H5O_type_t type; /**< Basic object type (group, dataset, etc.) */ + unsigned rc; /**< Reference count of object */ + time_t atime; /**< Access time */ + time_t mtime; /**< Modification time */ + time_t ctime; /**< Change time */ + time_t btime; /**< Birth time */ + hsize_t num_attrs; /**< # of attributes attached to object */ + H5O_hdr_info_t hdr; /**< Object header information */ /* Extra metadata storage for obj & attributes */ struct { - H5_ih_info_t obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ - H5_ih_info_t attr; /* v2 B-tree & heap for attributes */ + H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */ } meta_size; } H5O_info1_t; +//! <!-- [H5O_info1_t_snip] --> -/* Prototype for H5Ovisit/H5Ovisit_by_name() operator (versions 1 & 2) */ +//! <!-- [H5O_iterate1_t_snip] --> +/** + * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (versions 1 & 2) + */ typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data); +//! <!-- [H5O_iterate1_t_snip] --> /* Function prototypes */ -H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Opens an object using its address within an HDF5 file. + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] addr Object's address in the file + * + * \return \hid_tv{object} + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Oopen_by_token(). + * + * \details H5Oopen_by_addr() opens a group, dataset, or committed (named) datatype using its + * address within an HDF5 file, \p addr. The resulting opened object is identical to + * an object opened with H5Oopen() and should be closed with H5Oclose() or an + * object-type-specific closing function (such as H5Gclose()) when no longer needed. + * + * \p loc_id is a location identifier in the file. + * + * The object’s address within the file, \p addr, is the byte offset of the first byte + * of the object header from the beginning of the HDF5 file space, i.e., from the + * beginning of the super block (see the “HDF5 Storage Model” section of the The + * HDF5 Data Model and File Structure chapter of the <em>HDF5 User's Guide</em>.) + * + * \p addr can be obtained via either of two function calls. H5Gget_objinfo() returns + * the object’s address in the \c objno field of the H5G_stat_t \c struct; + * H5Lget_info() returns the address in the \c address field of the #H5L_info_t \c struct. + * + * The address of the HDF5 file on a physical device has no effect on H5Oopen_by_addr(), + * nor does the use of any file driver. As stated above, the object address is its + * offset within the HDF5 file; HDF5’s file drivers will transparently map this to an + * address on a storage device. + * + * \warning This function must be used with care! + * \warning Improper use can lead to inaccessible data, wasted space in the file, + * or <b><em>file corruption</em></b>. + * \warning This function is dangerous if called on an invalid address. The risk can be safely + * overcome by retrieving the object address with H5Gget_objinfo() or H5Lget_info() + * immediately before calling H5Oopen_by_addr(). The immediacy of the operation can be + * important; if time has elapsed and the object has been deleted from the file, + * the address will be invalid and file corruption can result. + * + * \version 1.8.4 Fortran subroutine added in this release. + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object specified by an identifier + * + * \fgdta_loc_obj_id{loc_id} + * \param[out] oinfo Buffer in which to return object information + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Oget_info3() or the macro #H5Oget_info. + * + * \details H5Oget_info1() specifies an object by its identifier, \p loc_id , and + * retrieves the metadata describing that object in \p oinfo , + * defined as a \c struct of type H5O_info1_t : + * + * \snippet this H5O_info1_t_snip + * + * Note the following about H5O_info1_t : + * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime) + * only \c ctime has been implemented. + * - The \c atime value is the last time the object was read or written. + * - The \c mtime value is the last time the raw data in the object was changed. + * - The \c ctime value is the last time the metadata for the object was changed. + * - The \c btime value is the time the object was created. + * - The fields nested in the \c meta_size field are for internal library use only. + * + * The #H5O_type_t \c enum indicates the object type and + * is defined in H5Opublic.h as follows: + * \snippet this H5O_type_t_snip + * + * Note that the object retrieved as indicated by \p loc_id + * refers only to the types specified by #H5O_type_t. + * + * An H5O_hdr_info_t \c struct holds object header metadata and is + * defined in H5Opublic.h as follows: + * \snippet this H5O_hdr_info_t_snip + * + * Valid values for the \c version field are \c H5O_VERSION_1 and \c H5O_VERSION_2. + * Version 2 of the object header is smaller and more efficient than version 1. + * + * Please be aware that the information held by H5O_hdr_info_t may only be useful to + * developers with extensive HDF5 experience. + * + * \note If you are iterating through a lot of different objects to + * retrieve information via the H5Oget_info() family of routines, + * you may see memory building up. This can be due to memory + * allocation for metadata such as object headers and messages + * when the iterated objects are put into the metadata cache. + * \note + * If the memory buildup is not desirable, you can configure a + * smaller cache via H5Fset_mdc_config() or set the file access + * property list via H5Pset_mdc_config(). A smaller sized cache + * will force metadata entries to be evicted from the cache, + * thus freeing the memory associated with the entries. + * + * \version 1.10.5 The macro #H5Oget_info was removed and the function + * H5Oget_info1() was copied to H5Oget_info(). + * \version 1.10.3 Function H5Oget_info() was copied to H5Oget_info1(), + * and the macro #H5Oget_info was created. + * \version 1.8.15 Added a note about the valid values for the \c version + * field in the H5O_hdr_info_t structure. + * \version 1.8.11 Fortran subroutine introduced in this release. + * \version 1.8.10 Added #H5O_type_t structure to the Description section. \n + * Separated H5O_hdr_info_t structure from #H5O_info_t in the + * Description section. \n + * Clarified the definition and implementation of the time fields. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object, identifying the object + * by location and relative name + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Name of group, relative to \p loc_id + * \param[out] oinfo Buffer in which to return object information + * \lapl_id + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Oget_info_by_name2() or the macro #H5Oget_info_by_name. + * + * \details H5Oget_info_by_name1() specifies an object’s location and name, \p loc_id + * and \p name, respectively, and retrieves the metadata describing that object + * in \p oinfo, an H5O_info1_t \c struct. + * + * The \c struct H5O_info1_t is defined in H5Opublic.h and described + * in the H5Oget_info1() function entry. + * + * The link access property list, \p lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \version 1.10.5 The macro #H5Oget_info_by_name was removed and the function + * H5Oget_info_by_name1() was copied to H5Oget_info_by_name(). + * \version 1.10.3 Function H5Oget_info_by_name() was copied to H5Oget_info_by_name1() + * and the macro #H5Oget_info_by_name was created. + * \version 1.8.8 Fortran 2003 subroutine and \c h5o_info_t derived type introduced + * in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object, identifying the object + * by an index position + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] group_name Name of group in which object is located + * \idx_type + * \order + * \param[in] n Position within the index + * \param[out] oinfo Buffer in which to return object information + * \lapl_id + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Oget_info_by_idx3() or the macro H5Oget_info_by_idx(). + * + * \details H5Oget_info_by_idx1() retrieves the metadata describing an + * object in the \c struct \p oinfo, as specified by the location, + * \p loc_id, group name, \p group_name, the index by which objects + * in that group are tracked, \p idx_type, the order by which the + * index is to be traversed, \p order, and an object’s position + * \p n within that index. + * + * If \p loc_id fully specifies the group in which the object resides, + * \p group_name can be a dot (\c .). + * + * \p idx_type is of type #H5_index_t, defined in H5public.h as: + * \snippet H5public.h H5_index_t_snip + * + * \p order is of type #H5_iter_order_t defined in H5public.h as: + * \snippet H5public.h H5_iter_order_t_snip + * + * \p oinfo, in which the object information is returned, is a \c struct of + * type H5O_info1_t . + * \snippet this H5O_info1_t_snip + * + * The link access property list, \c lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \version 1.10.5 The macro #H5Oget_info_by_idx was removed and the function + * H5Oget_info_by_idx() was copied to H5Oget_info_by_idx1(). + * \version 1.10.3 Function H5Oget_info_by_idx() was copied to H5Oget_info_by_idx1() + * and the macro #H5Oget_info_by_idx was created. + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object specified by an identifier + * + * \fgdta_loc_obj_id{loc_id} + * \param[out] oinfo Buffer in which to return object information + * \param[in] fields Flags specifying the fields to include in \p oinfo + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Oget_info3() or the macro H5Oget_info(). + * + * \details H5Oget_info2() specifies an object by its identifier, \p loc_id , and + * retrieves the metadata describing that object in \p oinfo , an H5O_info1_t \c struct. + * This \c struct type is described in H5Oget_info1(). + * + * The \p fields parameter contains flags to determine which fields will be filled in + * the H5O_info1_t \c struct returned in \p oinfo. + * These flags are defined in the H5Opublic.h file: + * + * \obj_info_fields + * + * \note If you are iterating through a lot of different objects to + * retrieve information via the H5Oget_info() family of routines, + * you may see memory building up. This can be due to memory + * allocation for metadata such as object headers and messages + * when the iterated objects are put into the metadata cache. + * \note + * If the memory buildup is not desirable, you can configure a + * smaller cache via H5Fset_mdc_config() or set the file access + * property list via H5Pset_mdc_config(). A smaller sized cache + * will force metadata entries to be evicted from the cache, + * thus freeing the memory associated with the entries. + * + * \since 1.10.3 + * + */ H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object, identifying the object + * by location and relative name + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] name Name of group, relative to \p loc_id + * \param[out] oinfo Buffer in which to return object information + * \param[in] fields Flags specifying the fields to include in \p oinfo + * \lapl_id + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Oget_info_by_name3() or the macro H5Oget_info_by_name(). + * + * \details H5Oget_info_by_name2() specifies an object’s location and name, \p loc_id and + * \p name, respectively, and retrieves the metadata describing + * that object in \p oinfo, an H5O_info1_t \c struct. + * + * The \c struct H5O_info1_t is defined in H5Opublic.h and described + * in the H5Oget_info1() function entry. + * + * The \p fields parameter contains flags to determine which fields + * will be filled in in the H5O_info1_t \c struct returned in + * \p oinfo. These flags are defined in the H5Opublic.h file: + * + * \obj_info_fields + * + * The link access property list, \p lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \since 1.10.3 + * + */ H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, unsigned fields, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Retrieves the metadata for an object, identifying the object + * by an index position + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] group_name Name of group in which object is located + * \idx_type + * \order + * \param[in] n Position within the index + * \param[out] oinfo Buffer in which to return object information + * \param[in] fields Flags specifying the fields to include in \p oinfo + * \lapl_id + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function is deprecated in favor of + * the function H5Oget_info_by_idx3() or the macro #H5Oget_info_by_idx. + * + * \details H5Oget_info_by_idx2() retrieves the metadata describing an + * object in the \c struct \p oinfo, as specified by the location, + * \p loc_id, group name, \p group_name, the index by which objects + * in that group are tracked, \p idx_type, the order by which the + * index is to be traversed, \p order, and an object’s position + * \p n within that index. + * + * \p oinfo, in which the object information is returned, is a \c struct of + * type H5O_info1_t. This and other \c struct types used + * by H5Oget_info_by_idx2() are described in H5Oget_info_by_idx1(). + * + * If \p loc_id fully specifies the group in which the object resides, + * i\p group_name can be a dot (\c .). + * + * The \p fields parameter contains flags to determine which fields will be + * filled in the H5O_info1_t \c struct returned in \p oinfo. + * These flags are defined in the H5Opublic.h file: + * \obj_info_fields + * + * The link access property list, \c lapl_id, is not currently used; + * it should be passed in as #H5P_DEFAULT. + * + * \since 1.10.3 + * + */ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, unsigned fields, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Recursively visits all objects accessible from a specified object + * + * \fgdta_loc_obj_id{obj_id} + * \idx_type + * \order + * \param[in] op Callback function passing data regarding the object + * to the calling application + * \param[in] op_data User-defined pointer to data required by the application + * for its processing of the object + * + * \return On success, returns the return value of the first operator + * that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * \return On failure, returns a negative value if something goes wrong + * within the library, or the first negative value returned by + * an operator. + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Ovisit3() or the macro #H5Ovisit. + * + * \details H5Ovisit1() is a recursive iteration function to visit the + * object \p obj_id and, if \p obj_id is a group, all objects in + * and below it in an HDF5 file, thus providing a mechanism for + * an application to perform a common set of operations across all + * of those objects or a dynamically selected subset. For + * non-recursive iteration across the members of a group, + * see H5Literate1(). + * + * If \p obj_id is a group identifier, that group serves as the + * root of a recursive iteration. If \p obj_id is a file identifier, + * that file’s root group serves as the root of the recursive + * iteration. If \p obj_id is an attribute identifier, + * then the object where the attribute is attached will be iterated. + * If \p obj_id is any other type of object, such as a dataset or + * named datatype, there is no iteration. + * + * Two parameters are used to establish the iteration: \p idx_type + * and \p order. + * + * \p idx_type specifies the index to be used. If the links in + * a group have not been indexed by the index type, they will + * first be sorted by that index then the iteration will begin; + * if the links have been so indexed, the sorting step will be + * unnecessary, so the iteration may begin more quickly. Valid + * values include the following: + * + * \indexes + * + * Note that the index type passed in \p idx_type is a + * <em>best effort</em> setting. If the application passes in + * a value indicating iteration in creation order and a group is + * encountered that was not tracked in creation order, that group + * will be iterated over in alpha-numeric order by name, or + * <em>name order</em>. (<em>Name order</em> is the native order + * used by the HDF5 library and is always available.) + * + * \p order specifies the order in which objects are to be inspected + * along the index specified in \p idx_type. Valid values include + * the following: + * + * \orders + * + * The prototype of the callback function op is as follows (as + * defined in the source code file H5Opublic.h): + * + * \snippet this H5O_iterate1_t_snip + * + * The parameters of this callback function have the following values + * or meanings: + * <table> + * <tr> + * <td>\c obj</td> + * <td>Object that serves as root of the iteration; + * same value as the H5Ovisit1() \p obj_id parameter</td> + * </tr> + * <tr> + * <td>\c name</td> + * <td>Name of object, relative to \c obj, being examined at + * current step of the iteration</td> + * </tr> + * <tr> + * <td>\c info</td> + * <td>H5O_info1_t \c struct containing information + * regarding that object</td> + * </tr> + * <tr> + * <td>\c op_data</td> + * <td>User-defined pointer to data required by the application in + * processing the object</td> + * </tr> + * </table> + * + * The H5O_info1_t \c struct is defined in H5Opublic.h: + * \snippet this H5O_info1_t_snip + * + * The return values from an operator are: + * - Zero causes the visit iterator to continue, returning zero when all + * group members have been processed. + * - A positive value causes the visit iterator to immediately return that + * positive value, indicating short-circuit success. + * - A negative value causes the visit iterator to immediately return that + * value, indicating failure. + * + * The H5Ovisit1() \p op_data parameter is a user-defined pointer to the data + * required to process objects in the course of the iteration. This pointer + * is passed back to each step of the iteration in the callback + * function’s \p op_data parameter. + * + * H5Lvisit1() and H5Ovisit1() are companion functions: one for + * examining and operating on links; the other for examining + * and operating on the objects that those links point to. Both + * functions ensure that by the time the function completes + * successfully, every link or object below the specified point + * in the file has been presented to the application for whatever + * processing the application requires. These functions assume + * that the membership of the group being iterated over remains + * unchanged through the iteration; if any of the links in the + * group change during the iteration, the resulting behavior + * is undefined. + * + * \note \Bold{Programming Note for C++ Developers Using C Functions:} + * \note 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. + * + * \note 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(). + * + * \note 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++ + * “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. + * + * \version 1.10.5 The macro #H5Ovisit was removed and the function + * H5Ovisit1() was copied to H5Ovisit(). + * \version 1.10.3 Function H5Ovisit() was copied to H5Ovisit1(), + * and the macro #H5Ovisit was created. + * \version 1.8.8 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Recursively visits all objects starting from a specified object + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] obj_name Name of the object, generally relative to + * \p loc_id, that will serve as root of the iteration + * \idx_type + * \order + * \param[in] op Callback function passing data regarding the object + * to the calling application + * \param[in] op_data User-defined pointer to data required by the application + * for its processing of the object + * \lapl_id + * + * \return On success, returns the return value of the first operator + * that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * \return On failure, returns a negative value if something goes wrong + * within the library, or the first negative value returned by + * an operator. + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Ovisit_by_name3() or the macro #H5Ovisit_by_name. + * + * \details H5Ovisit_by_name1() is a recursive iteration function to visit + * the object specified by the \p loc_id / \p obj_name parameter + * pair and, if that object is a group, all objects in and below it + * in an HDF5 file, thus providing a mechanism for an application to + * perform a common set of operations across all of those objects or + * a dynamically selected subset. For non-recursive iteration across + * the members of a group, see H5Literate1(). + * + * The object serving as the root of the iteration is specified + * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies + * a file or an object in a file; if \p loc_id is an attribute identifier, + * the object where the attribute is attached will be used. + * \p obj_name specifies either an object in the file (with an absolute + * name based in the file’s root group) or an object name relative + * to \p loc_id. If \p loc_id fully specifies the object that is to serve + * as the root of the iteration, \p obj_name should be '\c .' (a dot). + * (Note that when \p loc_id fully specifies the object that is to serve + * as the root of the iteration, the user may wish to consider + * using H5Ovisit1() instead of H5Ovisit_by_name1().) + * + * Two parameters are used to establish the iteration: \p idx_type + * and \p order. + * + * \p idx_type specifies the index to be used. If the links in + * a group have not been indexed by the index type, they will + * first be sorted by that index then the iteration will begin; + * if the links have been so indexed, the sorting step will be + * unnecessary, so the iteration may begin more quickly. Valid + * values include the following: + * + * \indexes + * + * Note that the index type passed in \p idx_type is a + * <em>best effort</em> setting. If the application passes in a + * value indicating iteration in creation order and a group is + * encountered that was not tracked in creation order, that group + * will be iterated over in alpha-numeric order by name, or + * <em>name order</em>. (<em>Name order</em> is the native order + * used by the HDF5 library and is always available.) + * + * \p order specifies the order in which objects are to be inspected + * along the index specified in \p idx_type. Valid values include + * the following: + * + * \orders + * + * The \p op callback function and the effect of the callback + * function’s return value on the application are described + * in H5Ovisit1(). + * + * The H5O_info1_t \c struct is defined in H5Opublic.h + * and described in the H5Oget_info1() function entry. + * + * The H5Ovisit_by_name1() \p op_data parameter is a user-defined + * pointer to the data required to process objects in the course + * of the iteration. This pointer is passed back to each step of + * the iteration in the callback function’s \p op_data parameter. + * + * \p lapl_id is a link access property list. In the general case, + * when default link access properties are acceptable, this can + * be passed in as #H5P_DEFAULT. An example of a situation that + * requires a non-default link access property list is when + * the link is an external link; an external link may require + * that a link prefix be set in a link access property list + * (see H5Pset_elink_prefix()). + * + * H5Lvisit_by_name1() and H5Ovisit_by_name1() are companion + * functions: one for examining and operating on links; the other + * for examining and operating on the objects that those links point to. + * Both functions ensure that by the time the function completes + * successfully, every link or object below the specified point + * in the file has been presented to the application for whatever + * processing the application requires. + * + * \note \Bold{Programming Note for C++ Developers Using C Functions:} + * \note 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. + * + * \note 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(). + * + * \note 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++ + * “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. + * + * \version 1.10.5 The macro #H5Ovisit_by_name was removed and the function + * H5Ovisit_by_name1() was copied to #H5Ovisit_by_name. + * \version 1.10.3 The H5Ovisit_by_name() function was renamed to H5Ovisit_by_name1(), + * and the macro #H5Ovisit_by_name was created. + * \version 1.8.11 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Recursively visits all objects accessible from a specified object + * + * \fgdta_loc_obj_id{obj_id} + * \idx_type + * \order + * \param[in] op Callback function passing data regarding the object + * to the calling application + * \param[in] op_data User-defined pointer to data required by the application + * for its processing of the object + * \param[in] fields Flags specifying the fields to be retrieved to the + * callback \p op + * + * \return On success, returns the return value of the first operator + * that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * \return On failure, returns a negative value if something goes wrong + * within the library, or the first negative value returned by + * an operator. + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Ovisit3() or the macro #H5Ovisit. + * + * \details H5Ovisit2() is a recursive iteration function to visit the + * object \p obj_id and, if \p obj_id is a group, all objects in + * and below it in an HDF5 file, thus providing a mechanism for + * an application to perform a common set of operations across all + * of those objects or a dynamically selected subset. For + * non-recursive iteration across the members of a group, + * see H5Literate1(). + * + * If \p obj_id is a group identifier, that group serves as the + * root of a recursive iteration. If \p obj_id is a file identifier, + * that file’s root group serves as the root of the recursive + * iteration. If \p obj_id is an attribute identifier, + * then the object where the attribute is attached will be iterated. + * If \p obj_id is any other type of object, such as a dataset or + * named datatype, there is no iteration. + * + * Two parameters are used to establish the iteration: \p idx_type + * and \p order. + * + * \p idx_type specifies the index to be used. If the links in + * a group have not been indexed by the index type, they will + * first be sorted by that index then the iteration will begin; + * if the links have been so indexed, the sorting step will be + * unnecessary, so the iteration may begin more quickly. Valid + * values include the following: + * + * \indexes + * + * Note that the index type passed in \p idx_type is a + * <em>best effort</em> setting. If the application passes in + * a value indicating iteration in creation order and a group is + * encountered that was not tracked in creation order, that group + * will be iterated over in alpha-numeric order by name, or + * <em>name order</em>. (<em>Name order</em> is the native order + * used by the HDF5 library and is always available.) + * + * \p order specifies the order in which objects are to be inspected + * along the index specified in \p idx_type. Valid values include + * the following: + * + * \orders + * + * The prototype of the callback function op is as follows (as + * defined in the source code file H5Opublic.h): + * + * \snippet this H5O_iterate1_t_snip + * + * The parameters of this callback function have the following values + * or meanings: + * <table> + * <tr> + * <td>\c obj</td> + * <td>Object that serves as root of the iteration; + * same value as the H5Ovisit1() \p obj_id parameter</td> + * </tr> + * <tr> + * <td>\c name</td> + * <td>Name of object, relative to \c obj, being examined at + * current step of the iteration</td> + * </tr> + * <tr> + * <td>\c info</td> + * <td>H5O_info1_t \c struct containing information + * regarding that object</td> + * </tr> + * <tr> + * <td>\c op_data</td> + * <td>User-defined pointer to data required by the application in + * processing the object; a pass-through of the \c op_data pointer + * provided with the H5Ovisit() function call</td> + * </tr> + * </table> + * + * The H5O_info1_t \c struct is defined in H5Opublic.h and + * described in the H5Oget_info1() function entry. + * + * The return values from an operator are: + * - Zero causes the visit iterator to continue, returning zero when all + * group members have been processed. + * - A positive value causes the visit iterator to immediately return that + * positive value, indicating short-circuit success. + * - A negative value causes the visit iterator to immediately return that + * value, indicating failure. + * + * The H5Ovisit2() \p op_data parameter is a user-defined pointer to the data + * required to process objects in the course of the iteration. This pointer + * is passed back to each step of the iteration in the callback + * function’s \p op_data parameter. + * + * The \p fields parameter contains flags to determine which fields will + * be retrieved by the \p op callback function. These flags are defined + * in the H5Opublic.h file: + * \obj_info_fields + * + * H5Lvisit() and H5Ovisit() are companion functions: one for + * examining and operating on links; the other for examining + * and operating on the objects that those links point to. Both + * functions ensure that by the time the function completes + * successfully, every link or object below the specified point + * in the file has been presented to the application for whatever + * processing the application requires. These functions assume + * that the membership of the group being iterated over remains + * unchanged through the iteration; if any of the links in the + * group change during the iteration, the resulting behavior + * is undefined. + * + * \note \Bold{Programming Note for C++ Developers Using C Functions:} + * \note 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. + * + * \note 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(). + * + * \note 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++ + * “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. + * + * \since 1.10.3 + * + */ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5O + * + * \brief Recursively visits all objects starting from a specified object + * + * \fgdta_loc_obj_id{loc_id} + * \param[in] obj_name Name of the object, generally relative to + * \p loc_id, that will serve as root of the iteration + * \idx_type + * \order + * \param[in] op Callback function passing data regarding the object + * to the calling application + * \param[in] op_data User-defined pointer to data required by the application + * for its processing of the object + * \param[in] fields Flags specifying the fields to be retrieved to the + * callback function \p op + * \lapl_id + * + * \return On success, returns the return value of the first operator + * that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * \return On failure, returns a negative value if something goes wrong + * within the library, or the first negative value returned by + * an operator. + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * the function H5Ovisit_by_name3() or the macro #H5Ovisit_by_name. + * + * \details H5Ovisit_by_name2() is a recursive iteration function to visit + * the object specified by the \p loc_id / \p obj_name parameter + * pair and, if that object is a group, all objects in and below it + * in an HDF5 file, thus providing a mechanism for an application to + * perform a common set of operations across all of those objects or + * a dynamically selected subset. For non-recursive iteration across + * the members of a group, see #H5Literate. + * + * The object serving as the root of the iteration is specified + * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies + * a file or an object in a file; if \p loc_id is an attribute identifier, + * the object where the attribute is attached will be used. + * \p obj_name specifies either an object in the file (with an absolute + * name based in the file’s root group) or an object name relative + * to \p loc_id. If \p loc_id fully specifies the object that is to serve + * as the root of the iteration, \p obj_name should be '\c .' (a dot). + * (Note that when \p loc_id fully specifies the object that is to serve + * as the root of the iteration, the user may wish to consider + * using H5Ovisit2() instead of #H5Ovisit_by_name.) + * + * Two parameters are used to establish the iteration: \p idx_type + * and \p order. + * + * \p idx_type specifies the index to be used. If the links in + * a group have not been indexed by the index type, they will + * first be sorted by that index then the iteration will begin; + * if the links have been so indexed, the sorting step will be + * unnecessary, so the iteration may begin more quickly. Valid + * values include the following: + * + * \indexes + * + * Note that the index type passed in \p idx_type is a + * <em>best effort</em> setting. If the application passes in a + * value indicating iteration in creation order and a group is + * encountered that was not tracked in creation order, that group + * will be iterated over in alpha-numeric order by name, or + * <em>name order</em>. (<em>Name order</em> is the native order + * used by the HDF5 library and is always available.) + * + * \p order specifies the order in which objects are to be inspected + * along the index specified in \p idx_type. Valid values include + * the following: + * + * \orders + * + * The \p op callback function and the effect of the callback + * function’s return value on the application are described + * in H5Ovisit2(). + * + * The H5O_info1_t \c struct is defined in H5Opublic.h + * and described in the H5Oget_info1() function entry. + * + * The H5Ovisit_by_name2() \p op_data parameter is a user-defined + * pointer to the data required to process objects in the course + * of the iteration. This pointer is passed back to each step of + * the iteration in the callback function’s \p op_data parameter. + * + * \p lapl_id is a link access property list. In the general case, + * when default link access properties are acceptable, this can + * be passed in as #H5P_DEFAULT. An example of a situation that + * requires a non-default link access property list is when + * the link is an external link; an external link may require + * that a link prefix be set in a link access property list + * (see H5Pset_elink_prefix()). + * + * The \p fields parameter contains flags to determine which fields will + * be retrieved by the \p op callback function. These flags are defined + * in the H5Opublic.h file: + * \obj_info_fields + * + * #H5Lvisit_by_name and #H5Ovisit_by_name are companion + * functions: one for examining and operating on links; the other + * for examining and operating on the objects that those links point to. + * Both functions ensure that by the time the function completes + * successfully, every link or object below the specified point + * in the file has been presented to the application for whatever + * processing the application requires. + * + * \note \Bold{Programming Note for C++ Developers Using C Functions:} + * \note 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. + * + * \note 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(). + * + * \note 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++ + * “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. + * + * \since 1.10.3 + * + */ H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields, hid_t lapl_id); diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h index c3555bc..55ff594 100644 --- a/src/H5PLpublic.h +++ b/src/H5PLpublic.h @@ -28,8 +28,7 @@ */ #define H5PL_NO_PLUGIN "::" -//! [H5PL_type_t_snip] - +//! <!-- [H5PL_type_t_snip] --> /** * Plugin type (bit-position) used by the plugin library */ @@ -39,8 +38,7 @@ typedef enum H5PL_type_t { H5PL_TYPE_VOL = 1, /**< VOL driver */ H5PL_TYPE_NONE = 2 /**< Sentinel: This must be last! */ } H5PL_type_t; - -//! [H5PL_type_t_snip] +//! <!-- [H5PL_type_t_snip] --> /* Common dynamic plugin type flags used by the set/get_loading_state functions */ #define H5PL_FILTER_PLUGIN 0x0001 diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h index 130cb90..18f30c6 100644 --- a/src/H5Pmodule.h +++ b/src/H5Pmodule.h @@ -44,7 +44,6 @@ * and compressed. * * \todo Describe concisely what the functions in this module are about. - * \todo Clicking on "more" after "Property List Interface" at the top does not work * * \defgroup GPLO General Property List Operations * \ingroup H5P @@ -70,6 +69,10 @@ * \ingroup H5P * \defgroup OCPPL Object Copy Properties * \ingroup H5P + * \defgroup GACPL General Access Properties + * \ingroup H5P + * \defgroup MAPL Map Access Properties + * \ingroup H5P */ #endif /* H5Pmodule_H */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 9638691..5adb05e 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -111,13 +111,50 @@ extern "C" { /*******************/ /* Define property list class callback function pointer types */ +//! <!-- [H5P_cls_create_func_t_snip] --> typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data); +//! <!-- [H5P_cls_create_func_t_snip] --> + +//! <!-- [H5P_cls_copy_func_t_snip] --> typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data); +//! <!-- [H5P_cls_copy_func_t_snip] --> + +//! <!-- [H5P_cls_close_func_t_snip] --> typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data); +//! <!-- [H5P_cls_close_func_t_snip] --> /* Define property list callback function pointer types */ +//! <!-- [H5P_prp_cb1_t_snip] --> +/** + * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1() + * + * \param[in] name The name of the property + * \param[in] size The size of the property in bytes + * \param[in,out] value The value for the property + * \return \herr_t + * + * \details The H5P_prp_cb1_t() describes the parameters used by the + * property create,copy and close callback functions. + */ typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value); +//! <!-- [H5P_prp_cb1_t_snip] --> + +//! <!-- [H5P_prp_cb2_t_snip] --> +/** + * \brief Callback function for H5Pregister2(),H5Pregister1(),H5Pinsert2(),H5Pinsert1() + * + * \plist_id{prop_id} + * \param[in] name The name of the property + * \param[in] size The size of the property in bytes + * \param[in] value The value for the property + * \return \herr_t + * + * \details The H5P_prp_cb2_t() describes the parameters used by the + * property set ,copy and delete callback functions. + */ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value); +//! <!-- [H5P_prp_cb2_t_snip] --> + typedef H5P_prp_cb1_t H5P_prp_create_func_t; typedef H5P_prp_cb2_t H5P_prp_set_func_t; typedef H5P_prp_cb2_t H5P_prp_get_func_t; @@ -125,56 +162,93 @@ typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *s typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value); typedef H5P_prp_cb2_t H5P_prp_delete_func_t; typedef H5P_prp_cb1_t H5P_prp_copy_func_t; + +//! <!-- [H5P_prp_compare_func_t_snip] --> typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size); +//! <!-- [H5P_prp_compare_func_t_snip] --> + typedef H5P_prp_cb1_t H5P_prp_close_func_t; /* Define property list iteration function type */ +//! <!-- [H5P_iterate_t_snip] --> typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); +//! <!-- [H5P_iterate_t_snip] --> -/* Actual IO mode property */ +//! <!--[H5D_mpio_actual_chunk_opt_mode_t_snip] --> +/** + * Actual IO mode property + * + * \details The default value, #H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all + * I/O operations that do not use chunk optimizations, including + * non-collective I/O and contiguous collective I/O. + */ typedef enum H5D_mpio_actual_chunk_opt_mode_t { - /* The default value, H5D_MPIO_NO_CHUNK_OPTIMIZATION, is used for all I/O - * operations that do not use chunk optimizations, including non-collective - * I/O and contiguous collective I/O. - */ H5D_MPIO_NO_CHUNK_OPTIMIZATION = 0, + /**< No chunk optimization was performed. Either no collective I/O was + attempted or the dataset wasn't chunked. */ H5D_MPIO_LINK_CHUNK, + /**< Collective I/O is performed on all chunks simultaneously. */ H5D_MPIO_MULTI_CHUNK + /**< Each chunk was individually assigned collective or independent I/O based + on what fraction of processes access the chunk. If the fraction is greater + than the multi chunk ratio threshold, collective I/O is performed on that + chunk. The multi chunk ratio threshold can be set using + H5Pset_dxpl_mpio_chunk_opt_ratio(). The default value is 60%. */ } H5D_mpio_actual_chunk_opt_mode_t; +//! <!--[H5D_mpio_actual_chunk_opt_mode_t_snip] --> +//! <!-- [H5D_mpio_actual_io_mode_t_snip] --> +/** + * The following values are conveniently defined as a bit field so that + * we can switch from the default to independent or collective and then to + * mixed without having to check the original value. + */ typedef enum H5D_mpio_actual_io_mode_t { - /* The following four values are conveniently defined as a bit field so that - * we can switch from the default to independent or collective and then to - * mixed without having to check the original value. - * - * NO_COLLECTIVE means that either collective I/O wasn't requested or that - * no I/O took place. - * - * CHUNK_INDEPENDENT means that collective I/O was requested, but the - * chunk optimization scheme chose independent I/O for each chunk. - */ - H5D_MPIO_NO_COLLECTIVE = 0x0, + H5D_MPIO_NO_COLLECTIVE = 0x0, + /**< No collective I/O was performed. Collective I/O was not requested or + collective I/O isn't possible on this dataset */ H5D_MPIO_CHUNK_INDEPENDENT = 0x1, - H5D_MPIO_CHUNK_COLLECTIVE = 0x2, - H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2, - - /* The contiguous case is separate from the bit field. */ + /**< HDF5 performed one the chunk collective optimization schemes and each + chunk was accessed independently */ + H5D_MPIO_CHUNK_COLLECTIVE = 0x2, + /**< HDF5 performed one the chunk collective optimization schemes and each + chunk was accessed collectively */ + H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2, + /**< HDF5 performed one the chunk collective optimization schemes and some + chunks were accessed independently, some collectively. */ + /** \internal The contiguous case is separate from the bit field. */ H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4 + /**< Collective I/O was performed on a contiguous dataset */ } H5D_mpio_actual_io_mode_t; +//! <!-- [H5D_mpio_actual_io_mode_t_snip] --> -/* Broken collective IO property */ +//! <!-- [H5D_mpio_no_collective_cause_t_snip] --> +/** + * Broken collective IO property + */ typedef enum H5D_mpio_no_collective_cause_t { - H5D_MPIO_COLLECTIVE = 0x00, - H5D_MPIO_SET_INDEPENDENT = 0x01, - H5D_MPIO_DATATYPE_CONVERSION = 0x02, - H5D_MPIO_DATA_TRANSFORMS = 0x04, - H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08, - H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10, - H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20, - H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40, + H5D_MPIO_COLLECTIVE = 0x00, + /**< Collective I/O was performed successfully */ + H5D_MPIO_SET_INDEPENDENT = 0x01, + /**< Collective I/O was not performed because independent I/O was requested */ + H5D_MPIO_DATATYPE_CONVERSION = 0x02, + /**< Collective I/O was not performed because datatype conversions were required */ + H5D_MPIO_DATA_TRANSFORMS = 0x04, + /**< Collective I/O was not performed because data transforms needed to be applied */ + H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08, + /**< \todo FIXME! */ + H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10, + /**< Collective I/O was not performed because one of the dataspaces was neither simple nor scalar */ + H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20, + /**< Collective I/O was not performed because the dataset was neither contiguous nor chunked */ + H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40, + /**< \todo FIXME! */ H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80, - H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100 + /**< \todo FIXME! */ + H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100 + /**< Sentinel */ } H5D_mpio_no_collective_cause_t; +//! <!-- [H5D_mpio_no_collective_cause_t_snip] --> /********************/ /* Public Variables */ @@ -252,6 +326,76 @@ H5_DLLVAR hid_t H5P_LST_REFERENCE_ACCESS_ID_g; */ H5_DLL herr_t H5Pclose(hid_t plist_id); /** + * \ingroup GPLOA + * + * \brief Closes an existing property list class + * + * \plistcls_id{plist_id} + * + * \return \herr_t + * + * \details H5Pclose_class() removes a property list class from the library. + * Existing property lists of this class will continue to exist, + * but new ones are not able to be created. + * + * \since 1.4.0 + * + */ +H5_DLL herr_t H5Pclose_class(hid_t plist_id); +/** + * \ingroup GPLO + * + * \brief Copies an existing property list to create a new property list + * + * \plist_id + * + * \return \hid_t{property list} + * + * \details H5Pcopy() copies an existing property list to create a new + * property list. The new property list has the same properties + * and values as the original property list. + * + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Pcopy(hid_t plist_id); +/** + * \ingroup GPLOA + * + * \brief Copies a property from one list or class to another + * + * \param[in] dst_id Identifier of the destination property list or class + * \param[in] src_id Identifier of the source property list or class + * \param[in] name Name of the property to copy + * + * \return \herr_t + * + * \details H5Pcopy_prop() copies a property from one property list or + * class to another. + * + * If a property is copied from one class to another, all the + * property information will be first deleted from the destination + * class and then the property information will be copied from the + * source class into the destination class. + * + * If a property is copied from one list to another, the property + * will be first deleted from the destination list (generating a + * call to the close callback for the property, if one exists) + * and then the property is copied from the source list to the + * destination list (generating a call to the copy callback for + * the property, if one exists). + * + * If the property does not exist in the class or list, this + * call is equivalent to calling H5Pregister() or H5Pinsert() (for + * a class or list, as appropriate) and the create callback will + * be called in the case of the property being copied into a list + * (if such a callback exists for the property). + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name); +/** * \ingroup GPLO * * \brief Creates a new property list as an instance of a property list class @@ -374,41 +518,1333 @@ H5_DLL herr_t H5Pclose(hid_t plist_id); * \since 1.0.0 * */ -H5_DLL hid_t H5Pcreate(hid_t cls_id); -H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t cls_create, - void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, - H5P_cls_close_func_t cls_close, void *close_data); -H5_DLL char * H5Pget_class_name(hid_t pclass_id); -H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, - H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, - H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, - H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, - H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, - H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, - H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, - H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value); -H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); +H5_DLL hid_t H5Pcreate(hid_t cls_id); +/** + * \ingroup GPLOA + * + * \brief Creates a new property list class + * + * \plistcls_id{parent} + * \param[in] name Name of property list class to register + * \param[in] create Callback routine called when a property list is + * created + * \param[in] create_data Pointer to user-defined class create data, to be + * passed along to class create callback + * \param[in] copy Callback routine called when a property list is + * copied + * \param[in] copy_data Pointer to user-defined class copy data, to be + * passed along to class copy callback + * \param[in] close Callback routine called when a property list is + * being closed + * \param[in] close_data Pointer to user-defined class close data, to be + * passed along to class close callback + * + * \return \hid_t{property list class} + * + * \details H5Pcreate_class() registers a new property list class with the + * library. The new property list class can inherit from an + * existing property list class, \p parent, or may be derived + * from the default “empty” class, NULL. New classes with + * inherited properties from existing classes may not remove + * those existing properties, only add or remove their own class + * properties. Property list classes defined and supported in the + * HDF5 library distribution are listed and briefly described in + * H5Pcreate(). The \p create routine is called when a new property + * list of this class is being created. The #H5P_cls_create_func_t + * callback function is defined as follows: + * + * \snippet this H5P_cls_create_func_t_snip + * + * The parameters to this callback function are defined as follows: + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list being created</td> + * </tr> + * <tr> + * <td>\Code{void * create_data}</td> + * <td>IN: User pointer to any class creation data required</td> + * </tr> + * </table> + * + * The \p create routine is called after any registered + * \p create function is called for each property value. If the + * \p create routine returns a negative value, the new list is not + * returned to the user and the property list creation routine returns + * an error value. + * + * The \p copy routine is called when an existing property + * list of this class is copied. The #H5P_cls_copy_func_t callback + * function is defined as follows: + * \snippet this H5P_cls_copy_func_t_snip + * + * The parameters to this callback function are defined as follows: + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list created by copying</td> + * </tr> + * <tr> + * <td>\Code{void * copy_data}</td> + * <td>IN: User pointer to any class copy data required</td> + * </tr> + * </table> + * + * The \p copy routine is called after any registered \p copy function + * is called for each property value. If the \p copy routine returns a + * negative value, the new list is not returned to the user and the + * property list \p copy routine returns an error value. + * + * The \p close routine is called when a property list of this class + * is being closed. The #H5P_cls_close_func_t callback function is + * defined as follows: + * \snippet this H5P_cls_close_func_t_snip + * + * The parameters to this callback function are defined as follows: + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list being closed</td> + * </tr> + * <tr> + * <td>\Code{void * close_data}</td> + * <td>IN: User pointer to any class close data required</td> + * </tr> + * </table> + * + * The \p close routine is called before any registered \p close + * function is called for each property value. If the \p close routine + * returns a negative value, the property list close routine returns + * an error value but the property list is still closed. + * + * H5Pclose_class() can be used to release the property list class + * identifier returned by this function so that resources leaks will + * not develop. + * + * \since 1.4.0 + * + */ +H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t create, void *create_data, + H5P_cls_copy_func_t copy, void *copy_data, H5P_cls_close_func_t close, + void *close_data); +/** + * \ingroup GPLO + * + * \brief Decodes property list received in a binary object buffer and + * returns a new property list identifier + * + * \param[in] buf Buffer holding the encoded property list + * + * \return \hid_tv{object} + * + * \details Given a binary property list description in a buffer, H5Pdecode() + * reconstructs the HDF5 property list and returns an identifier + * for the new property list. The binary description of the property + * list is encoded by H5Pencode(). + * + * The user is responsible for passing in the correct buffer. + * + * The property list identifier returned by this function should be + * released with H5Pclose() when the identifier is no longer needed + * so that resource leaks will not develop. + * + * \note Some properties cannot be encoded and therefore will not be available + * in the decoded property list. These properties are discussed in + * H5Pencode(). + * + * \since 1.10.0 + * + */ +H5_DLL hid_t H5Pdecode(const void *buf); +/** + * \ingroup GPLO + * + * \brief Encodes the property values in a property list into a binary + * buffer + * + * \plist_id + * \param[out] buf Buffer into which the property list will be encoded. + * If the provided buffer is NULL, the size of the + * buffer required is returned through \p nalloc; the + * function does nothing more. + * \param[out] nalloc The size of the required buffer + * \fapl_id + * + * \return \herr_t + * + * \details H5Pencode2() encodes the property list \p plist_id into the + * binary buffer \p buf, according to the file format setting + * specified by the file access property list \p fapl_id. + * + * If the required buffer size is unknown, \p buf can be passed + * in as NULL and the function will set the required buffer size + * in \p nalloc. The buffer can then be created and the property + * list encoded with a subsequent H5Pencode2() call. + * + * If the buffer passed in is not big enough to hold the encoded + * properties, the H5Pencode2() call can be expected to fail with + * a segmentation fault. + * + * The file access property list \p fapl_id is used to + * control the encoding via the \a libver_bounds property + * (see H5Pset_libver_bounds()). If the \a libver_bounds + * property is missing, H5Pencode2() proceeds as if the \a + * libver_bounds property were set to (#H5F_LIBVER_EARLIEST, + * #H5F_LIBVER_LATEST). (Functionally, H5Pencode1() is identical to + * H5Pencode2() with \a libver_bounds set to (#H5F_LIBVER_EARLIEST, + * #H5F_LIBVER_LATEST).) + * Properties that do not have encode callbacks will be skipped. + * There is currently no mechanism to register an encode callback for + * a user-defined property, so user-defined properties cannot currently + * be encoded. + * + * Some properties cannot be encoded, particularly properties that are + * reliant on local context. + * + * \b Motivation: + * This function was introduced in HDF5-1.12 as part of the \a H5Sencode + * format change to enable 64-bit selection encodings and a dataspace + * selection that is tied to a file. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id); -H5_DLL hid_t H5Pdecode(const void *buf); -H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); -H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops); -H5_DLL hid_t H5Pget_class(hid_t plist_id); -H5_DLL hid_t H5Pget_class_parent(hid_t pclass_id); -H5_DLL herr_t H5Pget(hid_t plist_id, const char *name, void *value); +/** + * \ingroup GPLOA + * + * \brief Compares two property lists or classes for equality + * + * \param[in] id1 First property object to be compared + * \param[in] id2 Second property object to be compared + * + * \return \htri_t + * + * \details H5Pequal() compares two property lists or classes to determine + * whether they are equal to one another. + * + * Either both \p id1 and \p id2 must be property lists or both + * must be classes; comparing a list to a class is an error. + * + * \since 1.4.0 + * + */ H5_DLL htri_t H5Pequal(hid_t id1, hid_t id2); +/** + * \ingroup GPLOA + * + * \brief Queries whether a property name exists in a property list or + * class + * + * \param[in] plist_id Identifier for the property list or class to query + * \param[in] name Name of property to check for + * + * \return \htri_t + * + * \details H5Pexist() determines whether a property exists within a + * property list or class. + * + * \since 1.4.0 + * + */ +H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); +/** + * \ingroup GPLOA + * + * \brief Queries the value of a property + * + * \plist_id + * \param[in] name Name of property to query + * \param[out] value Pointer to a location to which to copy the value of + * the property + * + * \return \herr_t + * + * \details H5Pget() retrieves a copy of the value for a property in a + * property list. If there is a \p get callback routine registered + * for this property, the copy of the value of the property will + * first be passed to that routine and any changes to the copy of + * the value will be used when returning the property value from + * this routine. + * + * This routine may be called for zero-sized properties with the + * \p value set to NULL. The \p get routine will be called with + * a NULL value if the callback exists. + * + * The property name must exist or this routine will fail. + * + * If the \p get callback routine returns an error, \ value will + * not be modified. + * + * \since 1.4.0 + * + */ +H5_DLL herr_t H5Pget(hid_t plist_id, const char *name, void *value); +/** + *\ingroup GPLO + * + * \brief Returns the property list class identifier for a property list + * + * \plist_id + * + * \return \hid_t{property list class} + * + * \details H5Pget_class() returns the property list class identifier for + * the property list identified by the \p plist_id parameter. + * + * Note that H5Pget_class() returns a value of #hid_t type, an + * internal HDF5 identifier, rather than directly returning a + * property list class. That identifier can then be used with + * either H5Pequal() or H5Pget_class_name() to determine which + * predefined HDF5 property list class H5Pget_class() has returned. + * + * A full list of valid predefined property list classes appears + * in the description of H5Pcreate(). + * + * Determining the HDF5 property list class name with H5Pequal() + * requires a series of H5Pequal() calls in an if-else sequence. + * An iterative sequence of H5Pequal() calls can compare the + * identifier returned by H5Pget_class() to members of the list of + * valid property list class names. A pseudo-code snippet might + * read as follows: + * + * \code + * plist_class_id = H5Pget_class (dsetA_plist); + * + * if H5Pequal (plist_class_id, H5P_OBJECT_CREATE) = TRUE; + * [ H5P_OBJECT_CREATE is the property list class ] + * [ returned by H5Pget_class. ] + * + * else if H5Pequal (plist_class_id, H5P_DATASET_CREATE) = TRUE; + * [ H5P_DATASET_CREATE is the property list class. ] + * + * else if H5Pequal (plist_class_id, H5P_DATASET_XFER) = TRUE; + * [ H5P_DATASET_XFER is the property list class. ] + * + * . + * . [ Continuing the iteration until a match is found. ] + * . + * \endcode + * + * H5Pget_class_name() returns the property list class name directly + * as a string: + * + * \code + * plist_class_id = H5Pget_class (dsetA_plist); + * plist_class_name = H5Pget_class_name (plist_class_id) + * \endcode + * + * Note that frequent use of H5Pget_class_name() can become a + * performance problem in a high-performance environment. The + * H5Pequal() approach is generally much faster. + * + * \version 1.6.0 Return type changed in this release. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Pget_class(hid_t plist_id); +/** + * \ingroup GPLOA + * + * \brief Retrieves the name of a class + * + * \plistcls_id{pclass_id} + * + * \return Returns a pointer to an allocated string containing the class + * name if successful, and NULL if not successful. + * + * \details H5Pget_class_name() retrieves the name of a generic property + * list class. The pointer to the name must be freed by the user + * with a call to H5free_memory() after each successful call. + * + * <table> + * <tr> + * <th>Class Name (class identifier) Returned</th> + * <th>Property List Class</th> + * <th>Expanded Name of the Property List Class</th> + * <th>The Class Identifier Used with H5Pcreate</th> + * <th>Comments</th> + * </tr> + * <tr> + * <td>attribute create</td> + * <td>acpl</td> + * <td>Attribute Creation Property List</td> + * <td>H5P_ATTRIBUTE_CREATE</td> + * <td> </td> + * </tr> + * <tr> + * <td>dataset access</td> + * <td>dapl</td> + * <td>Dataset Access Property List</td> + * <td>H5P_DATASET_ACCESS</td> + * <td> </td> + * </tr> + * <tr> + * <td>dataset create</td> + * <td>dcpl</td> + * <td>Dataset Creation Property List</td> + * <td>H5P_DATASET_CREATE</td> + * <td> </td> + * </tr> + * <tr> + * <td>data transfer</td> + * <td>dxpl</td> + * <td>Data Transfer Property List</td> + * <td>H5P_DATASET_XFER</td> + * <td> </td> + * </tr> + * <tr> + * <td>datatype access</td> + * <td> </td> + * <td> </td> + * <td>H5P_DATATYPE_ACCESS</td> + * <td>This class can be created, but there are no properties + * in the class currently. + * </td> + * </tr> + * <tr> + * <td>datatype create</td> + * <td> </td> + * <td> </td> + * <td>H5P_DATATYPE_CREATE</td> + * <td>This class can be created, but there + * are no properties in the class currently.</td> + * </tr> + * <tr> + * <td>file access</td> + * <td>fapl</td> + * <td>File Access Property List</td> + * <td>H5P_FILE_ACCESS</td> + * <td> </td> + * </tr> + * <tr> + * <td>file create</td> + * <td>fcpl</td> + * <td>File Creation Property List</td> + * <td>H5P_FILE_CREATE</td> + * <td> </td> + * </tr> + * <tr> + * <td>file mount</td> + * <td>fmpl</td> + * <td>File Mount Property List</td> + * <td>H5P_FILE_MOUNT</td> + * <td> </td> + * </tr> + * <tr> + * <td>group access</td> + * <td> </td> + * <td> </td> + * <td>H5P_GROUP_ACCESS</td> + * <td>This class can be created, but there + * are no properties in the class currently.</td> + * </tr> + * <tr> + * <td>group create</td> + * <td>gcpl</td> + * <td>Group Creation Property List</td> + * <td>H5P_GROUP_CREATE</td> + * <td> </td> + * </tr> + * <tr> + * <td>link access</td> + * <td>lapl</td> + * <td>Link Access Property List</td> + * <td>H5P_LINK_ACCESS</td> + * <td> </td> + * </tr> + * <tr> + * <td>link create</td> + * <td>lcpl</td> + * <td>Link Creation Property List</td> + * <td>H5P_LINK_CREATE</td> + * <td> </td> + * </tr> + * <tr> + * <td>object copy</td> + * <td>ocpypl</td> + * <td>Object Copy Property List</td> + * <td>H5P_OBJECT_COPY</td> + * <td> </td> + * </tr> + * <tr> + * <td>object create</td> + * <td>ocpl</td> + * <td>Object Creation Property List</td> + * <td>H5P_OBJECT_CREATE</td> + * <td> </td> + * </tr> + * <tr> + * <td>string create</td> + * <td>strcpl</td> + * <td>String Creation Property List</td> + * <td>H5P_STRING_CREATE</td> + * <td> </td> + * </tr> + * </table> + * + * \since 1.4.0 + * + */ +H5_DLL char *H5Pget_class_name(hid_t pclass_id); +/** + * \ingroup GPLOA + * + * \brief Retrieves the parent class of a property class + * + * \plistcls_id{pclass_id} + * + * \return \hid_t{parent class object} + * + * \details H5Pget_class_parent() retrieves an identifier for the parent + * class of a property class. + * + * \since 1.4.0 + * + */ +H5_DLL hid_t H5Pget_class_parent(hid_t pclass_id); +/** + * \ingroup GPLOA + * + * \brief Queries the number of properties in a property list or class + * + * \param[in] id Identifier for property object to query + * \param[out] nprops Number of properties in object + * + * \return \herr_t + * + * \details H5Pget_nprops() retrieves the number of properties in a + * property list or property list class. + * + * If \p id is a property list identifier, the current number of + * properties in the list is returned in \p nprops. + * + * If \p id is a property list class identifier, the number of + * registered properties in the class is returned in \p nprops. + * + * \since 1.4.0 + * + */ +H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops); +/** + * \ingroup GPLOA + * + * \brief Queries the size of a property value in bytes + * + * \param[in] id Identifier of property object to query + * \param[in] name Name of property to query + * \param[out] size Size of property in bytes + * + * \return \herr_t + * + * \details H5Pget_size() retrieves the size of a property's value in + * bytes. This function operates on both property lists and + * property classes. + * + * Zero-sized properties are allowed and return 0. + * + * \since 1.4.0 + * + */ +H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); +/** + * \ingroup GPLOA + * + * \brief Registers a temporary property with a property list + * + * \plist_id + * \param[in] name Name of property to create + * \param[in] size Size of property in bytes + * \param[in] value Initial value for the property + * \param[in] set Callback routine called before a new value is copied + * into the property's value + * \param[in] get Callback routine called when a property value is + * retrieved from the property + * \param[in] prp_del Callback routine called when a property is deleted + * from a property list + * \param[in] copy Callback routine called when a property is copied + * from an existing property list + * \param[in] compare Callback routine called when a property is compared + * with another property list + * \param[in] close Callback routine called when a property list is + * being closed and the property value will be disposed + * of + * + * \return \herr_t + * + * \details H5Pinsert2() creates a new property in a property + * list. The property will exist only in this property list and + * copies made from it. + * + * The initial property value must be provided in \p value and + * the property value will be set accordingly. + * + * The name of the property must not already exist in this list, + * or this routine will fail. + * + * The \p set and \p get callback routines may be set to NULL + * if they are not needed. + * + * Zero-sized properties are allowed and do not store any data + * in the property list. The default value of a zero-size + * property may be set to NULL. They may be used to indicate the + * presence or absence of a particular piece of information. + * + * The \p set routine is called before a new value is copied + * into the property. The #H5P_prp_set_func_t callback function + * is defined as follows: + * \snippet this H5P_prp_cb2_t_snip + * + * The parameters to the callback function are defined as follows: + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list being + * modified</td> + * </tr> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being modified</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN: Pointer to new value pointer for the property + * being modified</td> + * </tr> + * </table> + * + * The \p set routine may modify the value pointer to be set and + * those changes will be used when setting the property's value. + * If the \p set routine returns a negative value, the new property + * value is not copied into the property and the \p set routine + * returns an error value. The \p set routine will be called for + * the initial value. + * + * \b Note: The \p set callback function may be useful to range + * check the value being set for the property or may perform some + * transformation or translation of the value set. The \p get + * callback would then reverse the transformation or translation. + * A single \p get or \p set callback could handle multiple + * properties by performing different actions based on the + * property name or other properties in the property list. + * + * The \p get routine is called when a value is retrieved from + * a property value. The #H5P_prp_get_func_t callback function + * is defined as follows: + * + * \snippet this H5P_prp_cb2_t_snip + * + * The parameters to the above callback function are: + * + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list being queried</td> + * </tr> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being queried</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN: The value of the property being returned</td> + * </tr> + * </table> + * + * The \p get routine may modify the value to be returned from + * the query and those changes will be preserved. If the \p get + * routine returns a negative value, the query routine returns + * an error value. + * + * The \p prp_del routine is called when a property is being + * deleted from a property list. The #H5P_prp_delete_func_t + * callback function is defined as follows: + * + * \snippet this H5P_prp_cb2_t_snip + * + * The parameters to the above callback function are: + * + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list the property is + * being deleted from</td> + * </tr> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property in the list</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN: The value for the property being deleted</td> + * </tr> + * </table> + * + * The \p prp_del routine may modify the value passed in, but the + * value is not used by the library when the \p prp_del routine + * returns. If the \p prp_del routine returns a negative value, + * the property list \p prp_del routine returns an error value but + * the property is still deleted. + * + * The \p copy routine is called when a new property list with + * this property is being created through a \p copy operation. + * + * The #H5P_prp_copy_func_t callback function is defined as follows: + * + * \snippet this H5P_prp_cb1_t_snip + * + * The parameters to the above callback function are: + * <table> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being copied</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN/OUT: The value for the property being copied</td> + * </tr> + * </table> + * + * The \p copy routine may modify the value to be set and those + * changes will be stored as the new value of the property. If the + * \p copy routine returns a negative value, the new property value + * is not copied into the property and the copy routine returns an + * error value. + * + * The \p compare routine is called when a property list with this + * property is compared to another property list with the same + * property. + * + * The #H5P_prp_compare_func_t callback function is defined as + * follows: + * + * \snippet this H5P_prp_compare_func_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\Code{const void * value1}</td> + * <td>IN: The value of the first property to compare</td> + * </tr> + * <tr> + * <td>\Code{const void * value2}</td> + * <td>IN: The value of the second property to compare</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * </table> + * + * The \p compare routine may not modify the values. The \p compare + * routine should return a positive value if \p value1 is greater + * than \p value2, a negative value if \p value2 is greater than + * \p value1 and zero if \p value1 and \p value2 are equal. + * + * The \p close routine is called when a property list with this + * property is being closed. + * + * The #H5P_prp_close_func_t callback function is defined as follows: + * \snippet this H5P_prp_cb1_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property in the list</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN: The value for the property being closed</td> + * </tr> + * </table> + * + * The \p close routine may modify the value passed in, the + * value is not used by the library when the close routine + * returns. If the \p close routine returns a negative value, + * the property list \p close routine returns an error value + * but the property list is still closed. + * + * \b Note: There is no \p create callback routine for temporary + * property list objects; the initial value is assumed to + * have any necessary setup already performed on it. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t set, + H5P_prp_get_func_t get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t copy, + H5P_prp_compare_func_t compare, H5P_prp_close_func_t close); +/** + * \ingroup GPLOA + * + * \brief Determines whether a property list is a member of a class + * + * \plist_id + * \plistcls_id{pclass_id} + * + * \return \htri_t + * + * \details H5Pisa_class() checks to determine whether the property list + * \p plist_id is a member of the property list class + * \p pclass_id. + * + * \see H5Pcreate() + * + * \since 1.6.0 + * + */ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); -H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data); -H5_DLL herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name); +/** + * \ingroup GPLOA + * + * \brief Iterates over properties in a property class or list + * + * \param[in] id Identifier of property object to iterate over + * \param[in,out] idx Index of the property to begin with + * \param[in] iter_func Function pointer to function to be called + * with each property iterated over + * \param[in,out] iter_data Pointer to iteration data from user + * + * \return On success: the return value of the last call to \p iter_func if + * it was non-zero; zero if all properties have been processed. + * On Failure, a negative value + * + * \details H5Piterate() iterates over the properties in the property + * object specified in \p id, which may be either a property + * list or a property class, performing a specified operation + * on each property in turn. + * + * For each property in the object, \p iter_func and the + * additional information specified below are passed to the + * #H5P_iterate_t operator function. + * + * The iteration begins with the \p idx-th property in the + * object; the next element to be processed by the operator + * is returned in \p idx. If \p idx is NULL, the iterator + * starts at the first property; since no stopping point is + * returned in this case, the iterator cannot be restarted if + * one of the calls to its operator returns non-zero. + * + * The prototype for the #H5P_iterate_t operator is as follows: + * \snippet this H5P_iterate_t_snip + * + * The operation receives the property list or class + * identifier for the object being iterated over, \p id, the + * name of the current property within the object, \p name, + * and the pointer to the operator data passed in to H5Piterate(), + * \p iter_data. The valid return values from an operator are + * as follows: + * + * <table> + * <tr> + * <td>Zero</td> + * <td>Causes the iterator to continue, returning zero when all + * properties have been processed</td> + * </tr> + * <tr> + * <td>Positive</td> + * <td>Causes the iterator to immediately return that positive + * value, indicating short-circuit success. The iterator + * can be restarted at the index of the next property</td> + * </tr> + * <tr> + * <td>Negative</td> + * <td>Causes the iterator to immediately return that value, + * indicating failure. The iterator can be restarted at the + * index of the next property</td> + * </tr> + * </table> + * H5Piterate() assumes that the properties in the object + * identified by \p id remain unchanged through the iteration. + * If the membership changes during the iteration, the function's + * behavior is undefined. + * + * \since 1.4.0 + * + */ +H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data); +/** + * \ingroup GPLOA + * + * \brief Registers a permanent property with a property list class + * + * \plistcls_id{cls_id} + * \param[in] name Name of property to register + * \param[in] size Size of property in bytes + * \param[in] def_value Default value for property in newly created + * property lists + * \param[in] create Callback routine called when a property list is + * being created and the property value will be + * initialized + * \param[in] set Callback routine called before a new value is + * copied into the property's value + * \param[in] get Callback routine called when a property value is + * retrieved from the property + * \param[in] prp_del Callback routine called when a property is deleted + * from a property list + * \param[in] copy Callback routine called when a property is copied + * from a property list + * \param[in] compare Callback routine called when a property is compared + * with another property list + * \param[in] close Callback routine called when a property list is + * being closed and the property value will be + * disposed of + * + * \return \herr_t + * + * \details H5Pregister2() registers a new property with a property list + * class. The \p cls_id identifier can be obtained by calling + * H5Pcreate_class(). The property will exist in all property + * list objects of \p cl_id created after this routine finishes. The + * name of the property must not already exist, or this routine + * will fail. The default property value must be provided and all + * new property lists created with this property will have the + * property value set to the default value. Any of the callback + * routines may be set to NULL if they are not needed. + * + * Zero-sized properties are allowed and do not store any data in + * the property list. These may be used as flags to indicate the + * presence or absence of a particular piece of information. The + * default pointer for a zero-sized property may be set to NULL. + * The property \p create and \p close callbacks are called for + * zero-sized properties, but the \p set and \p get callbacks are + * never called. + * + * The \p create routine is called when a new property list with + * this property is being created. The #H5P_prp_create_func_t + * callback function is defined as follows: + * + * \snippet this H5P_prp_cb1_t_snip + * + * The parameters to this callback function are defined as follows: + * + * <table> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being modified</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN/OUT: The default value for the property being created, + * which will be passed to H5Pregister2()</td> + * </tr> + * </table> + * + * The \p create routine may modify the value to be set and those + * changes will be stored as the initial value of the property. + * If the \p create routine returns a negative value, the new + * property value is not copied into the property and the + * \p create routine returns an error value. + * + * The \p set routine is called before a new value is copied into + * the property. The #H5P_prp_set_func_t callback function is defined + * as follows: + * + * \snippet this H5P_prp_cb2_t_snip + * + * The parameters to this callback function are defined as follows: + * + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list being modified</td> + * </tr> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being modified</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void *value}</td> + * <td>IN/OUT: Pointer to new value pointer for the property + * being modified</td> + * </tr> + * </table> + * + * The \p set routine may modify the value pointer to be set and + * those changes will be used when setting the property's value. + * If the \p set routine returns a negative value, the new property + * value is not copied into the property and the \p set routine + * returns an error value. The \p set routine will not be called + * for the initial value; only the \p create routine will be called. + * + * \b Note: The \p set callback function may be useful to range + * check the value being set for the property or may perform some + * transformation or translation of the value set. The \p get + * callback would then reverse the transformation or translation. + * A single \p get or \p set callback could handle multiple + * properties by performing different actions based on the property + * name or other properties in the property list. + * + * The \p get routine is called when a value is retrieved from a + * property value. The #H5P_prp_get_func_t callback function is + * defined as follows: + * + * \snippet this H5P_prp_cb2_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list being + * queried</td> + * </tr> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being queried</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN/OUT: The value of the property being returned</td> + * </tr> + * </table> + * + * The \p get routine may modify the value to be returned from the + * query and those changes will be returned to the calling routine. + * If the \p set routine returns a negative value, the query + * routine returns an error value. + * + * The \p prp_del routine is called when a property is being + * deleted from a property list. The #H5P_prp_delete_func_t + * callback function is defined as follows: + * + * \snippet this H5P_prp_cb2_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\ref hid_t \c prop_id</td> + * <td>IN: The identifier of the property list the property is + * being deleted from</td> + * </tr> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property in the list</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN: The value for the property being deleted</td> + * </tr> + * </table> + * + * The \p prp_del routine may modify the value passed in, but the + * value is not used by the library when the \p prp_del routine + * returns. If the \p prp_del routine returns a negative value, + * the property list delete routine returns an error value but + * the property is still deleted. + * + * The \p copy routine is called when a new property list with + * this property is being created through a \p copy operation. + * The #H5P_prp_copy_func_t callback function is defined as follows: + * + * \snippet this H5P_prp_cb1_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property being copied</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN/OUT: The value for the property being copied</td> + * </tr> + * </table> + * + * The \p copy routine may modify the value to be set and those + * changes will be stored as the new value of the property. If + * the \p copy routine returns a negative value, the new + * property value is not copied into the property and the \p copy + * routine returns an error value. + * + * The \p compare routine is called when a property list with this + * property is compared to another property list with the same + * property. The #H5P_prp_compare_func_t callback function is + * defined as follows: + * + * \snippet this H5P_prp_compare_func_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\Code{const void * value1}</td> + * <td>IN: The value of the first property to compare</td> + * </tr> + * <tr> + * <td>\Code{const void * value2}</td> + * <td>IN: The value of the second property to compare</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * </table> + * + * The \p compare routine may not modify the values. The \p compare + * routine should return a positive value if \p value1 is greater + * than \p value2, a negative value if \p value2 is greater than + * \p value1 and zero if \p value1 and \p value2 are equal. + * + * The \p close routine is called when a property list with this + * property is being closed. The #H5P_prp_close_func_t callback + * function is defined as follows: + * + * \snippet this H5P_prp_cb1_t_snip + * + * The parameters to the callback function are defined as follows: + * + * <table> + * <tr> + * <td>\Code{const char * name}</td> + * <td>IN: The name of the property in the list</td> + * </tr> + * <tr> + * <td>\Code{size_t size}</td> + * <td>IN: The size of the property in bytes</td> + * </tr> + * <tr> + * <td>\Code{void * value}</td> + * <td>IN: The value for the property being closed</td> + * </tr> + * </table> + * + * The \p close routine may modify the value passed in, but the + * value is not used by the library when the \p close routine returns. + * If the \p close routine returns a negative value, the property + * list close routine returns an error value but the property list is + * still closed. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, + H5P_prp_create_func_t create, H5P_prp_set_func_t set, H5P_prp_get_func_t get, + H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t copy, + H5P_prp_compare_func_t compare, H5P_prp_close_func_t close); +/** + * \ingroup GPLOA + * + * \brief Removes a property from a property list + * + * \plist_id + * \param[in] name Name of property to remove + * + * \return \herr_t + * + * \details H5Premove() removes a property from a property list. Both + * properties which were in existence when the property list was + * created (i.e. properties registered with H5Pregister()) and + * properties added to the list after it was created (i.e. added + * with H5Pinsert1() may be removed from a property list. + * Properties do not need to be removed from a property list + * before the list itself is closed; they will be released + * automatically when H5Pclose() is called. + * + * If a \p close callback exists for the removed property, it + * will be called before the property is released. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Premove(hid_t plist_id, const char *name); +/** + * \ingroup GPLOA + * + * \brief Sets a property list value + * + * \plist_id + * \param[in] name Name of property to modify + * \param[in] value Pointer to value to set the property to + * + * \return \herr_t + * + * \details H5Pset() sets a new value for a property in a property list. + * If there is a \p set callback routine registered for this + * property, the \p value will be passed to that routine and any + * changes to the \p value will be used when setting the property + * value. The information pointed to by the \p value pointer + * (possibly modified by the \p set callback) is copied into the + * property list value and may be changed by the application + * making the H5Pset() call without affecting the property value. + * + * The property name must exist or this routine will fail. + * + * If the \p set callback routine returns an error, the property + * value will not be modified. + * + * This routine may not be called for zero-sized properties and + * will return an error in that case. + * + * \since 1.4.0 + * + */ +H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value); +/** + * \ingroup GPLOA + * + * \brief Removes a property from a property list class + * + * \plistcls_id{pclass_id} + * \param[in] name Name of property to remove + * + * \return \herr_t + * + * \details H5Punregister() removes a property from a property list class. + * Future property lists created of that class will not contain + * this property; existing property lists containing this property + * are not affected. + * + * \since 1.4.0 + * + */ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name); -H5_DLL herr_t H5Pclose_class(hid_t plist_id); -H5_DLL hid_t H5Pcopy(hid_t plist_id); /* Object creation property list (OCPL) routines */ /** + * \ingroup DCPL + * + * \brief Verifies that all required filters are available + * + * \plist_id + * + * \return \htri_t + * + * \details H5Pall_filters_avail() verifies that all of the filters set in + * the dataset or group creation property list \p plist_id are + * currently available. + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * \since 1.6.0 + * + */ +H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id); +/** + * \ingroup OCPL + * + * \brief Retrieves tracking and indexing settings for attribute creation + * order + * + * \plist_id + * \param[out] crt_order_flags Flags specifying whether to track and + * index attribute creation order + * + * \return \herr_t + * + * \details H5Pget_attr_creation_order() retrieves the settings for + * tracking and indexing attribute creation order on an object. + * + * \p plist_id is an object creation property list (\p ocpl), + * as it can be a dataset or group creation property list + * identifier. The term \p ocpl is used when different types + * of objects may be involved. + * + * \p crt_order_flags returns flags with the following meanings: + * + * <table> + * <tr> + * <td>#H5P_CRT_ORDER_TRACKED</td> + * <td>Attribute creation order is tracked but not necessarily + * indexed.</td> + * </tr> + * <tr> + * <td>#H5P_CRT_ORDER_INDEXED </td> + * <td>Attribute creation order is indexed (requires + * #H5P_CRT_ORDER_TRACKED).</td> + * </tr> + * </table> + * + * If \p crt_order_flags is returned with a value of 0 (zero), + * attribute creation order is neither tracked nor indexed. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags); +/** + * \ingroup OCPL + * + * \brief Retrieves attribute storage phase change thresholds + * + * \plist_id + * \param[out] max_compact Maximum number of attributes to be stored in + * compact storage (Default: 8) + * \param[out] min_dense Minimum number of attributes to be stored in + * dense storage (Default: 6) + * + * \return \herr_t + * + * \details H5Pget_attr_phase_change() retrieves threshold values for + * attribute storage on an object. These thresholds determine the + * point at which attribute storage changes from compact storage + * (i.e., storage in the object header) to dense storage (i.e., + * storage in a heap and indexed with a B-tree). + * + * In the general case, attributes are initially kept in compact + * storage. When the number of attributes exceeds \p max_compact, + * attribute storage switches to dense storage. If the number of + * attributes subsequently falls below \p min_dense, the + * attributes are returned to compact storage. + * + * If \p max_compact is set to 0 (zero), dense storage always used. + * + * \p plist_id is an object creation property list (\p ocpl), as it + * can be a dataset or group creation property list identifier. + * The term \p ocpl is used when different types of objects may be + * involved. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, unsigned *min_dense); +/** * \ingroup OCPL * * \brief Returns information about a filter in a pipeline @@ -416,7 +1852,7 @@ H5_DLL hid_t H5Pcopy(hid_t plist_id); * \todo Signature for H5Pget_filter2 is different in H5Pocpl.c than in * H5Ppublic.h * - * \plist_id{plist_id} + * \ocpl_id{plist_id} * \param[in] idx Sequence number within the filter pipeline of the filter * for which information is sought * \param[out] flags Bit vector specifying certain general properties of the @@ -475,117 +1911,3623 @@ H5_DLL hid_t H5Pcopy(hid_t plist_id); H5_DLL H5Z_filter_t H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[], unsigned *filter_config /*out*/); -H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense); -H5_DLL herr_t H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact, unsigned *min_dense); -H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags); -H5_DLL herr_t H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags); -H5_DLL herr_t H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times); -H5_DLL herr_t H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times); +/** + * \ingroup OCPL + * + * \brief Returns information about the specified filter + * + * \ocpl_id{plist_id} + * \param[in] filter_id Filter identifier + * \param[out] flags Bit vector specifying certain general + * properties of the filter + * \param[in,out] cd_nelmts Number of elements in \p cd_values + * \param[out] cd_values[] Auxiliary data for the filter + * \param[in] namelen Length of filter name and number of + * elements in \p name + * \param[out] name[] Name of filter + * \param[out] filter_config Bit field, as described in + * H5Zget_filter_info() + * + * \return \herr_t + * + * \details H5Pget_filter_by_id2() returns information about the filter + * specified in \p filter_id, a filter identifier. + * + * \p plist_id must be a dataset or group creation property list + * and \p filter_id must be in the associated filter pipeline. + * + * The \p filter_id and \p flags parameters are used in the same + * manner as described in the discussion of H5Pset_filter(). + * + * Aside from the fact that they are used for output, the + * parameters \p cd_nelmts and \p cd_values[] are used in the same + * manner as described in the discussion of H5Pset_filter(). On + * input, the \p cd_nelmts parameter indicates the number of + * entries in the \p cd_values[] array allocated by the calling + * program; on exit it contains the number of values defined by + * the filter. + * + * On input, the \p namelen parameter indicates the number of + * characters allocated for the filter name by the calling program + * in the array \p name[]. On exit \p name[] contains the name of the + * filter with one character of the name in each element of the + * array. + * + * \p filter_config is the bit field described in + * H5Zget_filter_info(). + * + * If the filter specified in \p filter_id is not set for the + * property list, an error will be returned and + * H5Pget_filter_by_id2() will fail. + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t filter_id, unsigned int *flags /*out*/, + size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, + char name[] /*out*/, unsigned *filter_config /*out*/); +/** + * \ingroup OCPL + * + * \brief Returns the number of filters in the pipeline + * + * \ocpl_id{plist_id} + * + * \return Returns the number of filters in the pipeline if successful; + * otherwise returns a negative value. + * + * \details H5Pget_nfilters() returns the number of filters defined in the + * filter pipeline associated with the property list \p plist_id. + * + * In each pipeline, the filters are numbered from 0 through \Code{N-1}, + * where \c N is the value returned by this function. During output to + * the file, the filters are applied in increasing order; during + * input from the file, they are applied in decreasing order. + * + * H5Pget_nfilters() returns the number of filters in the pipeline, + * including zero (0) if there are none. + * + * \since 1.0.0 + * + */ +H5_DLL int H5Pget_nfilters(hid_t plist_id); +/** + * \ingroup OCPL + * + * \brief Determines whether times associated with an object + * are being recorded + * + * \plist_id + * \param[out] track_times Boolean value, 1 (TRUE) or 0 (FALSE), + * specifying whether object times are being recorded + * + * \return \herr_t + * + * \details H5Pget_obj_track_times() queries the object creation property + * list, \p plist_id, to determine whether object times are being + * recorded. + * + * If \p track_times is returned as 1, times are being recorded; + * if \p track_times is returned as 0, times are not being + * recorded. + * + * Time data can be retrieved with H5Oget_info(), which will return + * it in the #H5O_info_t struct. + * + * If times are not tracked, they will be reported as follows + * when queried: 12:00 AM UDT, Jan. 1, 1970 + * + * See H5Pset_obj_track_times() for further discussion. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times); +/** + * \ingroup OCPL + * + * \brief Modifies a filter in the filter pipeline + * + * \ocpl_id{plist_id} + * \param[in] filter Filter to be modified + * \param[in] flags Bit vector specifying certain general properties + * of the filter + * \param[in] cd_nelmts Number of elements in \p cd_values + * \param[in] cd_values[] Auxiliary data for the filter + * + * \return \herr_t + * + * \details H5Pmodify_filter() modifies the specified \p filter in the + * filter pipeline. \p plist_id must be a dataset or group + * creation property list. + * + * The \p filter, \p flags \p cd_nelmts[], and \p cd_values + * parameters are used in the same manner and accept the same + * values as described in the discussion of H5Pset_filter(). + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * \since 1.6.0 + * + */ H5_DLL herr_t H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/]); +/** + * \ingroup OCPL + * + * \brief Delete one or more filters in the filter pipeline + * + * \ocpl_id{plist_id} + * \param[in] filter Filter to be deleted + * + * \return \herr_t + * + * \details H5Premove_filter() removes the specified \p filter from the + * filter pipeline in the dataset or group creation property + * list \p plist_id. + * + * The \p filter parameter specifies the filter to be removed. + * Valid values for use in \p filter are as follows: + * + * <table> + * <tr> + * <td>#H5Z_FILTER_ALL</td> + * <td>Removes all filters from the filter pipeline</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_DEFLATE</td> + * <td>Data compression filter, employing the gzip + * algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_SHUFFLE</td> + * <td>Data shuffling filter</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_FLETCHER32</td> + * <td>Error detection filter, employing the Fletcher32 + * checksum algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_SZIP</td> + * <td>Data compression filter, employing the SZIP + * algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_NBIT</td> + * <td>Data compression filter, employing the N-Bit + * algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_SCALEOFFSET</td> + * <td>Data compression filter, employing the scale-offset + * algorithm</td> + * </tr> + * </table> + * + * Additionally, user-defined filters can be removed with this + * routine by passing the filter identifier with which they were + * registered with the HDF5 library. + * + * Attempting to remove a filter that is not in the filter + * pipeline is an error. + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * \since 1.6.3 + * + */ +H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter); +/** + * \ingroup OCPL + * + * \brief Sets tracking and indexing of attribute creation order + * + * \plist_id + * \param[in] crt_order_flags Flags specifying whether to track and index + * attribute creation order. \em Default: No + * flag set; attribute creation order is neither + * tracked not indexed + * + * \return \herr_t + * + * \details H5Pset_attr_creation_order() sets flags for tracking and + * indexing attribute creation order on an object. + * + * \p plist_id is a dataset or group creation property list + * identifier. + * + * \p crt_order_flags contains flags with the following meanings: + * + * <table> + * <tr> + * <td>#H5P_CRT_ORDER_TRACKED</td> + * <td>Attribute creation order is tracked but not necessarily + * indexed.</td> + * </tr> + * <tr> + * <td>#H5P_CRT_ORDER_INDEXED </td> + * <td>Attribute creation order is indexed (requires + * #H5P_CRT_ORDER_TRACKED).</td> + * </tr> + * </table> + * + * Default behavior is that attribute creation order is neither + * tracked nor indexed. + * + * H5Pset_attr_creation_order() can be used to set attribute + * creation order tracking, or to set attribute creation order + * tracking and indexing. + * + * \note If a creation order index is to be built, it must be specified in + * the object creation property list. HDF5 currently provides no + * mechanism to turn on attribute creation order tracking at object + * creation time and to build the index later. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags); +/** + * \ingroup OCPL + * + * \brief Sets attribute storage phase change thresholds + * + * \plist_id + * \param[in] max_compact Maximum number of attributes to be stored in + * compact storage (\em Default: 8); must be greater + * than or equal to \p min_dense + * + * \param[in] min_dense Minimum number of attributes to be stored in + * dense storage (\em Default: 6) + * + * \return \herr_t + * + * \details H5Pset_attr_phase_change() sets threshold values for attribute + * storage on an object. These thresholds determine the point at + * which attribute storage changes from compact storage (i.e., + * storage in the object header) to dense storage (i.e., storage + * in a heap and indexed with a B-tree). + * + * In the general case, attributes are initially kept in compact + * storage. When the number of attributes exceeds \p max_compact, + * attribute storage switches to dense storage. If the number of + * attributes subsequently falls below \p min_dense, the attributes + * are returned to compact storage. + * + * If \p max_compact is set to 0 (zero), dense storage is always + * used. \p min_dense must be set to 0 (zero) when \p max_compact + * is 0 (zero). + * + * \p plist_id is a dataset or group creation property list + * identifier. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense); +/** + * \ingroup OCPL + * + * \brief Sets deflate (GNU gzip) compression method and compression level + * + * \ocpl_id{plist_id} + * \param[in] level Compression level + * + * \return \herr_t + * + * \details H5Pset_deflate() sets the deflate compression method and the + * compression level, \p level, for a dataset or group creation + * property list, \p plist_id. + * + * The filter identifier set in the property list is + * #H5Z_FILTER_DEFLATE. + * + * The compression level, \p level, is a value from zero to nine, + * inclusive. A compression level of 0 (zero) indicates no + * compression; compression improves but speed slows progressively + * from levels 1 through 9: + * + * <table> + * <tr> + * <th>Compression Level</th> + * <th>Gzip Action</th> + * </tr> + * <tr> + * <td>0</td> + * <td>No compression</td> + * </tr> + * <tr> + * <td>1</td> + * <td>Best compression speed; least compression</td> + * </tr> + * <tr> + * <td>2 through 8</td> + * <td>Compression improves; speed degrades</td> + * </tr> + * <tr> + * <td>9</td> + * <td>Best compression ratio; slowest speed</td> + * </tr> + * </table> + * + * Note that setting the compression level to 0 (zero) does not turn + * off use of the gzip filter; it simply sets the filter to perform + * no compression as it processes the data. + * + * HDF5 relies on GNU gzip for this compression. + * + * \version 1.8.5 Function extended to work with group creation property lists. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); +/** + * \ingroup OCPL + * + * \brief Adds a filter to the filter pipeline + * + * \ocpl_id{plist_id} + * \param[in] filter Filter identifier for the filter to be added to the + * pipeline + * \param[in] flags Bit vector specifying certain general properties of + * the filter + * \param[in] cd_nelmts Number of elements in \p c_values + * \param[in] c_values Auxiliary data for the filter + * + * \return \herr_t + * + * \details H5Pset_filter() adds the specified \p filter identifier and + * corresponding properties to the end of an output filter + * pipeline. + * + * \p plist_id must be either a dataset creation property list or + * group creation property list identifier. If \p plist_id is a + * dataset creation property list identifier, the filter is added + * to the raw data filter pipeline. + * + * If \p plist_id is a group creation property list identifier, + * the filter is added to the link filter pipeline, which filters + * the fractal heap used to store most of the link metadata in + * certain types of groups. The only predefined filters that can + * be set in a group creation property list are the gzip filter + * (#H5Z_FILTER_DEFLATE) and the Fletcher32 error detection filter + * (#H5Z_FILTER_FLETCHER32). + * + * The array \p c_values contains \p cd_nelmts integers which are + * auxiliary data for the filter. The integer values will be + * stored in the dataset object header as part of the filter + * information. + * + * The \p flags argument is a bit vector with the following + * fields specifying certain general properties of the filter: + * + * <table> + * <tr> + * <td>#H5Z_FLAG_OPTIONAL</td> + * <td>If this bit is set then the filter is optional. If the + * filter fails (see below) during an H5Dwrite() operation + * then the filter is just excluded from the pipeline for + * the chunk for which it failed; the filter will not + * participate in the pipeline during an H5Dread() of the + * chunk. This is commonly used for compression filters: + * if the filter result would be larger than the input, + * then the compression filter returns failure and the + * uncompressed data is stored in the file.<br /><br /> + * This flag should not be set for the Fletcher32 checksum + * filter as it will bypass the checksum filter without + * reporting checksum errors to an application.</td> + * </tr> + * <tr> + * <td>#H5Z_FLAG_MANDATORY</td> + * <td>If the filter is required, that is, set to mandatory, + * and the filter fails, the library’s behavior depends + * on whether the chunk cache is in use: + * \li If the chunk cache is enabled, data chunks will + * be flushed to the file during H5Dclose() and the + * library will return the failure in H5Dclose(). + * \li When the chunk cache is disabled or not big enough, + * or the chunk is being evicted from the cache, the + * failure will happen during H5Dwrite(). + * + * In each case, the library will still write to the file + * all data chunks that were processed by the filter + * before the failure occurred.<br /><br /> + * For example, assume that an application creates a + * dataset of four chunks, the chunk cache is enabled and + * is big enough to hold all four chunks, and the filter + * fails when it tries to write the fourth chunk. The + * actual flush of the chunks will happen during + * H5Dclose(), not H5Dwrite(). By the time H5Dclose() + * fails, the first three chunks will have been written + * to the file. Even though H5Dclose() fails, all the + * resources will be released and the file can be closed + * properly. <br /><br /> + * If, however, the filter fails on the second chunk, only + * the first chunk will be written to the file as nothing + * further can be written once the filter fails.</td> + * </tr> + * </table> + * The \p filter parameter specifies the filter to be set. Valid + * pre-defined filter identifiers are as follows: + * + * <table> + * <tr> + * <td>#H5Z_FILTER_DEFLATE</td> + * <td>Data compression filter, employing the gzip + * algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_SHUFFLE</td> + * <td>Data shuffling filter</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_FLETCHER32</td> + * <td>Error detection filter, employing the Fletcher32 + * checksum algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_SZIP</td> + * <td>Data compression filter, employing the SZIP + * algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_NBIT</td> + * <td>Data compression filter, employing the N-Bit + * algorithm</td> + * </tr> + * <tr> + * <td>#H5Z_FILTER_SCALEOFFSET</td> + * <td>Data compression filter, employing the scale-offset + * algorithm</td> + * </tr> + * </table> + * Also see H5Pset_edc_check() and H5Pset_filter_callback(). + * + * \note When a non-empty filter pipeline is used with a group creation + * property list, the group will be created with the new group file + * format. The filters will come into play only when dense storage + * is used (see H5Pset_link_phase_change()) and will be applied to + * the group’s fractal heap. The fractal heap will contain most of + * the the group’s link metadata, including link names. + * + * \note When working with group creation property lists, if you are + * adding a filter that is not in HDF5’s set of predefined filters, + * i.e., a user-defined or third-party filter, you must first + * determine that the filter will work for a group. See the + * discussion of the set local and can apply callback functions + * in H5Zregister(). + * + * \note If multiple filters are set for a property list, they will be + * applied to each chunk of raw data for datasets or each block + * of the fractal heap for groups in the order in which they were + * set. + * + * \note Filters can be applied only to chunked datasets; they cannot be + * used with other dataset storage methods, such as contiguous, + * compact, or external datasets. + * + * \note Dataset elements of variable-length and dataset region + * reference datatypes are stored in separate structures in the + * file called heaps. Filters cannot currently be applied to + * these heaps. + * + * \note <b>Filter Behavior in HDF5:</b><br /> + * Filters can be inserted into the HDF5 pipeline to perform + * functions such as compression and conversion. As such, they are + * a very flexible aspect of HDF5; for example, a user-defined + * filter could provide encryption for an HDF5 dataset. + * + * \note A filter can be declared as either required or optional. + * Required is the default status; optional status must be + * explicitly declared. + * + * \note A required filter that fails or is not defined causes an + * entire output operation to fail; if it was applied when the + * data was written, such a filter will cause an input operation + * to fail. + * + * \note The following table summarizes required filter behavior. + * <table> + * <tr> + * <th></th> + * <th>Required FILTER_X not available</th> + * <th>FILTER_X available</th> + * </tr> + * <tr> + * <td>H5Pset_<FILTER_X></td> + * <td>Will fail.</td> + * <td>Will succeed.</td> + * </tr> + * <tr> + * <td>H5Dwrite with FILTER_X set</td> + * <td>Will fail.</td> + * <td>Will succeed; FILTER_X will be applied to + * the data.</td> + * </tr> + * <tr> + * <td>H5Dread with FILTER_X set</td> + * <td>Will fail.</td> + * <td>Will succeed.</td> + * </tr> + * </table> + * \note An optional filter can be set for an HDF5 dataset even when + * the filter is not available. Such a filter can then be + * applied to the dataset when it becomes available on the + * original system or when the file containing the dataset is + * processed on a system on which it is available. + * + * \note A filter can be declared as optional through the use of the + * #H5Z_FLAG_OPTIONAL flag with H5Pset_filter(). + * + * \note Consider a situation where one is creating files that will + * normally be used only on systems where the optional (and + * fictional) filter FILTER_Z is routinely available. One can + * create those files on system A, which lacks FILTER_Z, create + * chunked datasets in the files with FILTER_Z defined in the + * dataset creation property list, and even write data to those + * datasets. The dataset object header will indicate that FILTER_Z + * has been associated with this dataset. But since system A does + * not have FILTER_Z, dataset chunks will be written without it + * being applied. + * + * \note HDF5 has a mechanism for determining whether chunks are + * actually written with the filters specified in the object + * header, so while the filter remains unavailable, system A will + * be able to read the data. Once the file is moved to system B, + * where FILTER_Z is available, HDF5 will apply FILTER_Z to any + * data rewritten or new data written in these datasets. Dataset + * chunks that have been written on system B will then be + * unreadable on system A; chunks that have not been re-written + * since being written on system A will remain readable on system + * A. All chunks will be readable on system B. + * + * \note The following table summarizes optional filter behavior. + * <table> + * <tr> + * <th></th> + * <th>FILTER_Z not available</th> + * <th>FILTER_Z available<br /> with encode and decode</th> + * <th>FILTER_Z available decode only</th> + * </tr> + * <tr> + * <td>H5Pset_<FILTER_Z></td> + * <td>Will succeed.</td> + * <td>Will succeed.</td> + * <td>Will succeed.</td> + * </tr> + * <tr> + * <td>H5Dread with FILTER_Z set</td> + * <td>Will succeed if FILTER_Z has not actually<br /> + * been applied to data.</td> + * <td>Will succeed.</td> + * <td>Will succeed.</td> + * </tr> + * <tr> + * <td>H5Dwrite with FILTER_Z set</td> + * <td>Will succeed;<br /> + * FILTER_Z will not be applied to the data.</td> + * <td>Will succeed;<br /> + * FILTER_Z will be applied to the data.</td> + * <td>Will succeed;<br /> + * FILTER_Z will not be applied to the data.</td> + * </tr> + * </table> + * \note The above principles apply generally in the use of HDF5 + * optional filters insofar as HDF5 does as much as possible to + * complete an operation when an optional filter is unavailable. + * (The SZIP filter is an exception to this rule; see H5Pset_szip() + * for details.) + * + * \see \ref_filter_pipe, \ref_group_impls + * + * \version 1.8.5 Function applied to group creation property lists. + * \since 1.6.0 + * + */ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd_nelmts, const unsigned int c_values[]); -H5_DLL int H5Pget_nfilters(hid_t plist_id); -H5_DLL herr_t H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, - size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, - char name[] /*out*/, unsigned *filter_config /*out*/); -H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id); -H5_DLL herr_t H5Premove_filter(hid_t plist_id, H5Z_filter_t filter); -H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression); +/** + * \ingroup OCPL + * + * \brief Sets up use of the Fletcher32 checksum filter + * + * \ocpl_id{plist_id} + * + * \return \herr_t + * + * \details H5Pset_fletcher32() sets the Fletcher32 checksum filter in the + * dataset or group creation property list \p plist_id. + * + * \attention The Fletcher32 EDC checksum filter was added in HDF5 Release + * 1.6.0. In the original implementation, however, the checksum + * value was calculated incorrectly on little-endian systems. + * The error was fixed in HDF5 Release 1.6.3. + * + * \attention As a result of this fix, an HDF5 library of Release 1.6.0 + * through Release 1.6.2 cannot read a dataset created or written + * with Release 1.6.3 or later if the dataset was created with + * the checksum filter and the filter is enabled in the reading + * library. (Libraries of Release 1.6.3 and later understand the + * earlier error and compensate appropriately.) + * + * \attention \b Work-around: An HDF5 library of Release 1.6.2 or earlier + * will be able to read a dataset created or written with the + * checksum filter by an HDF5 library of Release 1.6.3 or later + * if the checksum filter is disabled for the read operation. + * This can be accomplished via a call to H5Pset_edc_check() + * with the value #H5Z_DISABLE_EDC in the second parameter. + * This has the obvious drawback that the application will be + * unable to verify the checksum, but the data does remain + * accessible. + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * \version 1.6.3 Error in checksum calculation on little-endian systems + * corrected in this release. + * \since 1.6.0 + * + */ H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id); +/** + * \ingroup OCPL + * + * \brief Sets the recording of times associated with an object + * + * \param[in] plist_id Object creation property list identifier + * \param[in] track_times Boolean value, 1 or 0, specifying whether object + * times are to be tracked + * + * \return \herr_t + * + * \details H5Pset_obj_track_times() sets a property in the object creation + * property list, \p plist_id, that governs the recording of times + * associated with an object. + * + * If \p track_times is set to 1, time data will be recorded. If + * \p track_times is set to 0, time data will not be recorded. + * + * Time data can be retrieved with H5Oget_info(), which will + * return it in the #H5O_info_t struct. + * + * If times are not tracked, they will be reported as follows when queried: + * \Code{ 12:00 AM UDT, Jan. 1, 1970} + * + * That date and time are commonly used to represent the beginning of the UNIX epoch. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times); /* File creation property list (FCPL) routines */ -H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size); -H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size); -H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size); -H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /*out*/); -H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk); -H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/); -H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik); +/** + * \ingroup FCPL + * + * \brief Retrieves the file space page size for a file creation property + * list + * + * \fcpl_id{plist_id} + * \param[out] fsp_size File space page size + * + * \return \herr_t + * + * \details H5Pget_file_space_page_size() retrieves the file space page + * size for paged aggregation in the parameter \p fsp_size. + * + * The library default is 4KB (4096) if \p fsp_size is not + * previously set via a call to H5Pset_file_space_page_size(). + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size); +/** + * \ingroup FCPL + * + * \brief Retrieves the file space handling strategy, persisting free-space + * condition and threshold value for a file creation property list + * + * \fcpl_id{plist_id} + * \param[out] strategy The file space handling strategy + * \param[out] persist The boolean value indicating whether free space is + * persistent or not + * \param[out] threshold The free-space section size threshold value + * + * \return \herr_t + * + * \details H5Pget_file_space_strategy() retrieves the file space handling + * strategy, the persisting free-space condition and the threshold + * value in the parameters \p strategy, \p persist and + * \p threshold respectively. + * + * The library default values returned when + * H5Pset_file_space_strategy() has not been called are: + * + * \li \p strategy - #H5F_FSPACE_STRATEGY_FSM_AGGR + * \li \p persist - 0 + * \li \p threshold - 1 + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist, + hsize_t *threshold); +/** + * \ingroup FCPL + * + * \brief Queries the 1/2 rank of an indexed storage B-tree + * + * \fcpl_id{plist_id} + * \param[out] ik Pointer to location to return the chunked storage B-tree + * 1/2 rank (<em>Default value of B-tree 1/2 rank: 32</em>) + * + * \return \herr_t + * + * \details H5Pget_istore_k() queries the 1/2 rank of an indexed storage + * B-tree. + * + * The argument \p ik may be the null pointer (NULL). + * This function is valid only for file creation property lists. + * + * \see H5Pset_istore_k() + * + * \version 1.6.4 \p ik parameter type changed to \em unsigned. + * \since 1.0.0 + * + */ H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out*/); -H5_DLL herr_t H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes); -H5_DLL herr_t H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes); -H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags, - unsigned min_mesg_size); +/** + * \ingroup FCPL + * + * \brief Retrieves the configuration settings for a shared message index + * + * \fcpl_id{plist_id} + * \param[in] index_num Index being configured + * \param[out] mesg_type_flags Types of messages that may be stored in + * this index + * \param[out] min_mesg_size Minimum message size + * + * \return \herr_t + * + * \details H5Pget_shared_mesg_index() retrieves the message type and + * minimum message size settings from the file creation property + * list \p plist_id for the shared object header message index + * specified by \p index_num. + * + * \p index_num specifies the index. \p index_num is zero-indexed, + * so in a file with three indexes, they will be numbered 0, 1, + * and 2. + * + * \p mesg_type_flags and \p min_mesg_size will contain, + * respectively, the types of messages and the minimum size, in + * bytes, of messages that can be stored in this index. + * + * Valid message types are described in H5Pset_shared_mesg_index(). + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type_flags, unsigned *min_mesg_size); -H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree); +/** + * \ingroup FCPL + * + * \brief Retrieves the number of shared object header message indexes in file + * creation property list + * + * \fcpl_id{plist_id} + * \param[out] nindexes Number of shared object header message indexes + * available in files created with this property list + * + * \return \herr_t + * + * \details H5Pget_shared_mesg_nindexes() retrieves the number of shared + * object header message indexes in the specified file creation + * property list \p plist_id. + * + * If the value of \p nindexes is 0 (zero), shared object header + * messages are disabled in files created with this property list. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes); +/** + * \ingroup FCPL + * + * \brief Retrieves shared object header message phase change information + * + * \fcpl_id{plist_id} + * \param[out] max_list Threshold above which storage of a shared object + * header message index shifts from list to B-tree + * \param[out] min_btree Threshold below which storage of a shared object + * header message index reverts to list format + * + * \return \herr_t + * + * \details H5Pget_shared_mesg_phase_change() retrieves the threshold values + * for storage of shared object header message indexes in a file. + * These phase change thresholds determine the point at which the + * index storage mechanism changes from a more compact list format + * to a more performance-oriented B-tree format, and vice-versa. + * + * By default, a shared object header message index is initially + * stored as a compact list. When the number of messages in an + * index exceeds the specified \p max_list threshold, storage + * switches to a B-tree format for improved performance. If the + * number of messages subsequently falls below the \p min_btree + * threshold, the index will revert to the list format. + * + * If \p max_list is set to 0 (zero), shared object header message + * indexes in the file will always be stored as B-trees. + * + * \p plist_id specifies the file creation property list. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *min_btree); +/** + * \ingroup FCPL + * + * \brief Retrieves the size of the offsets and lengths used in an HDF5 + * file + * + * \fcpl_id{plist_id} + * \param[out] sizeof_addr Pointer to location to return offset size in + * bytes + * \param[out] sizeof_size Pointer to location to return length size in + * bytes + * + * \return \herr_t + * + * \details H5Pget_sizes() retrieves the size of the offsets and lengths + * used in an HDF5 file. This function is only valid for file + * creation property lists. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /*out*/); +/** + * \ingroup FCPL + * + * \brief Retrieves the size of the symbol table B-tree 1/2 rank and the + * symbol table leaf node 1/2 size + * + * \fcpl_id{plist_id} + * \param[out] ik Pointer to location to return the symbol table's B-tree + * 1/2 rank (<em>Default value of B-tree 1/2 rank: 16</em>) + * \param[out] lk Pointer to location to return the symbol table's leaf + * node 1/2 size (<em>Default value of leaf node 1/2 + * size: 4</em>) + * + * \return \herr_t + * + * \details H5Pget_sym_k() retrieves the size of the symbol table B-tree + * 1/2 rank and the symbol table leaf node 1/2 size. + * + * This function is valid only for file creation property lists. + * + * If a parameter value is set to NULL, that parameter is not + * retrieved. + * + * \see H5Pset_sym_k() + * + * \version 1.6.4 \p ik parameter type changed to \em unsigned + * \version 1.6.0 The \p ik parameter has changed from type int to + * \em unsigned + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/); +/** + * \ingroup FCPL + * + * \brief Retrieves the size of a user block + * + * \fcpl_id{plist_id} + * \param[out] size Pointer to location to return user-block size + * + * \return \herr_t + * + * \details H5Pget_userblock() retrieves the size of a user block in a + * file creation property list. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size); +/** + * \ingroup FCPL + * + * \brief Sets the file space page size for a file creation property list + * + * \fcpl_id{plist_id} + * \param[in] fsp_size File space page size + * + * \return \herr_t + * + * \details H5Pset_file_space_page_size() sets the file space page size + * \p fsp_size used in paged aggregation and paged buffering. + * + * \p fsp_size has a minimum size of 512. Setting a value less + * than 512 will return an error. The library default size for + * the file space page size when not set is 4096. + * + * The size set via this routine may not be changed for the life + * of the file. + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size); +/** + * \ingroup FCPL + * + * \brief Sets the file space handling strategy and persisting free-space + * values for a file creation property list + * + * \fcpl_id{plist_id} + * \param[in] strategy The file space handling strategy to be used. See: + * #H5F_fspace_strategy_t + * \param[in] persist A boolean value to indicate whether free space + * should be persistent or not + * \param[in] threshold The smallest free-space section size that the free + * space manager will track + * + * \return \herr_t + * + * \details H5Pset_file_space_strategy() sets the file space handling + * \p strategy, specifies persisting free-space or not (\p persist), + * and sets the free-space section size \p threshold in the file + * creation property list \p plist_id. + * + * #H5F_fspace_strategy_t is a struct defined in H5Fpublic.h as + * follows: + * + * \snippet H5Fpublic.h H5F_fspace_strategy_t_snip + * + * This setting cannot be changed for the life of the file. + * + * As the #H5F_FSPACE_STRATEGY_AGGR and #H5F_FSPACE_STRATEGY_NONE + * strategies do not use the free-space managers, the \p persist + * and \p threshold settings will be ignored for those strategies. + * + * \since 1.10.1 + * + */ H5_DLL herr_t H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold); -H5_DLL herr_t H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy, hbool_t *persist, - hsize_t *threshold); -H5_DLL herr_t H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size); -H5_DLL herr_t H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size); +/** + * \ingroup FCPL + * + * \brief Sets the size of the parameter used to control the B-trees for + * indexing chunked datasets + * + * \fcpl_id{plist_id} + * \param[in] ik 1/2 rank of chunked storage B-tree + * + * \return \herr_t + * + * \details H5Pset_istore_k() sets the size of the parameter used to + * control the B-trees for indexing chunked datasets. This + * function is valid only for file creation property lists. + * + * \p ik is one half the rank of a tree that stores chunked + * raw data. On average, such a tree will be 75% full, or have + * an average rank of 1.5 times the value of \p ik. + * + * The HDF5 library uses (\p ik*2) as the maximum # of entries + * before splitting a B-tree node. Since only 2 bytes are used + * in storing # of entries for a B-tree node in an HDF5 file, + * (\p ik*2) cannot exceed 65536. The default value for + * \p ik is 32. + * + * \version 1.6.4 \p ik parameter type changed to \p unsigned. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik); +/** + * \ingroup FCPL + * + * \brief Configures the specified shared object header message index + * + * \fcpl_id{plist_id} + * \param[in] index_num Index being configured + * \param[in] mesg_type_flags Types of messages that should be stored in + * this index + * \param[in] min_mesg_size Minimum message size + * + * \return \herr_t + * + * \details H5Pset_shared_mesg_index() is used to configure the specified + * shared object header message index, setting the types of + * messages that may be stored in the index and the minimum size + * of each message. + * + * \p plist_id specifies the file creation property list. + * + * \p index_num specifies the index to be configured. + * \p index_num is zero-indexed, so in a file with three indexes, + * they will be numbered 0, 1, and 2. + * + * \p mesg_type_flags and \p min_mesg_size specify, respectively, + * the types and minimum size of messages that can be stored in + * this index. + * + * Valid message types are as follows: + * + * <table> + * <tr> + * <td>#H5O_SHMESG_NONE_FLAG</td> + * <td>No shared messages</td> + * </tr> + * <tr> + * <td>#H5O_SHMESG_SDSPACE_FLAG</td> + * <td>Simple dataspace message</td> + * </tr> + * <tr> + * <td>#H5O_SHMESG_DTYPE_FLAG</td> + * <td>Datatype message</td> + * </tr> + * <tr> + * <td>#H5O_SHMESG_FILL_FLAG</td> + * <td>Fill value message</td> + * </tr> + * <tr> + * <td>#H5O_SHMESG_PLINE_FLAG</td> + * <td>Filter pipeline message</td> + * </tr> + * <tr> + * <td>#H5O_SHMESG_ATTR_FLAG</td> + * <td>Attribute message</td> + * </tr> + * <tr> + * <td>#H5O_SHMESG_ALL_FLAG</td> + * <td>All message types; i.e., equivalent to the following: + * (#H5O_SHMESG_SDSPACE_FLAG | #H5O_SHMESG_DTYPE_FLAG | + * #H5O_SHMESG_FILL_FLAG | #H5O_SHMESG_PLINE_FLAG | + * #H5O_SHMESG_ATTR_FLAG)</td> + * </tr> + * </table> + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_flags, + unsigned min_mesg_size); +/** + * \ingroup FCPL + * + * \brief Sets number of shared object header message indexes + * + * \fcpl_id{plist_id} + * \param[in] nindexes Number of shared object header message indexes to be + * available in files created with this property list + * (\p nindexes must be <= #H5O_SHMESG_MAX_NINDEXES (8)) + * + * \return \herr_t + * + * \details H5Pset_shared_mesg_nindexes() sets the number of shared object + * header message indexes in the specified file creation property + * list. + * + * This setting determines the number of shared object header + * message indexes, \p nindexes, that will be available in files + * created with this property list. These indexes can then be + * configured with H5Pset_shared_mesg_index(). + * + * If \p nindexes is set to 0 (zero), shared object header messages + * are disabled in files created with this property list. + * + * There is a limit of #H5O_SHMESG_MAX_NINDEXES (8) that can be set + * with H5Pset_shared_mesg_nindexes(). An error will occur if + * specifying a value of \p nindexes that is greater than this value. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes); +/** + * \ingroup FCPL + * + * \brief Sets shared object header message storage phase change thresholds + * + * \fcpl_id{plist_id} + * \param[in] max_list Threshold above which storage of a shared object + * header message index shifts from list to B-tree + * \param[in] min_btree Threshold below which storage of a shared object + * header message index reverts to list format + * + * \return \herr_t + * + * \details H5Pset_shared_mesg_phase_change() sets threshold values for + * storage of shared object header message indexes in a file. + * These phase change thresholds determine the point at which the + * index storage mechanism changes from a more compact list format + * to a more performance-oriented B-tree format, and vice-versa. + * + * By default, a shared object header message index is initially + * stored as a compact list. When the number of messages in an + * index exceeds the threshold value of \p max_list, storage + * switches to a B-tree for improved performance. If the number + * of messages subsequently falls below the \p min_btree threshold, + * the index will revert to the list format. + * + * If \p max_list is set to 0 (zero), shared object header message + * indexes in the file will be created as B-trees and will never + * revert to lists. + * + * \p plist_id specifies the file creation property list. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_btree); +/** + * \ingroup FCPL + * + * \brief Sets the byte size of the offsets and lengths used to address + * objects in an HDF5 file + * + * \fcpl_id{plist_id} + * \param[in] sizeof_addr Size of an object offset in bytes + * \param[in] sizeof_size Size of an object length in bytes + * + * \return \herr_t + * + * \details H5Pset_sizes() sets the byte size of the offsets and lengths + * used to address objects in an HDF5 file. This function is only + * valid for file creation property lists. Passing in a value + * of 0 for one of the parameters retains the current value. The + * default value for both values is the same as sizeof(hsize_t) + * in the library (normally 8 bytes). Valid values currently + * are 2, 4, 8 and 16. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size); +/** + * \ingroup FCPL + * + * \brief + * + * \fcpl_id{plist_id} + * \param[in] ik Symbol table tree rank + * \param[in] lk Symbol table node size + * + * \return \herr_t + * + * \details H5Pset_sym_k() sets the size of parameters used to control the + * symbol table nodes. + * + * This function is valid only for file creation property lists. + * Passing in a value of zero (0) for one of the parameters retains + * the current value. + * + * \p ik is one half the rank of a B-tree that stores a symbol + * table for a group. Internal nodes of the symbol table are on + * average 75% full. That is, the average rank of the tree is + * 1.5 times the value of \p ik. The HDF5 library uses (\p ik*2) as + * the maximum # of entries before splitting a B-tree node. Since + * only 2 bytes are used in storing # of entries for a B-tree node + * in an HDF5 file, (\p ik*2) cannot exceed 65536. The default value + * for \p ik is 16. + * + * \p lk is one half of the number of symbols that can be stored in + * a symbol table node. A symbol table node is the leaf of a symbol + * table tree which is used to store a group. When symbols are + * inserted randomly into a group, the group's symbol table nodes are + * 75% full on average. That is, they contain 1.5 times the number of + * symbols specified by \p lk. The default value for \p lk is 4. + * + * \version 1.6.4 \p ik parameter type changed to \em unsigned. + * \version 1.6.0 The \p ik parameter has changed from type int to + * \em unsigned. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk); +/** + * \ingroup FCPL + * + * \brief Sets user block size + * + * \fcpl_id{plist_id} + * \param[in] size Size of the user-block in bytes + * + * \return \herr_t + * + * \details H5Pset_userblock() sets the user block size of a file creation + * property list. The default user block size is 0; it may be set + * to any power of 2 equal to 512 or greater (512, 1024, 2048, etc.). + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size); /* File access property list (FAPL) routines */ -H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment); -H5_DLL herr_t H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment /*out*/); -H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); -H5_DLL hid_t H5Pget_driver(hid_t plist_id); +/** + * \ingroup FAPL + * + * \brief Retrieves the current settings for alignment properties from a + * file access property list + * + * \fapl_id + * \param[out] threshold Pointer to location of return threshold value + * \param[out] alignment Pointer to location of return alignment value + * + * \return \herr_t + * + * \details H5Pget_alignment() retrieves the current settings for + * alignment properties from a file access property list. The + * \p threshold and/or \p alignment pointers may be null + * pointers (NULL). + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment /*out*/); +/** + * \ingroup FAPL + * + * \brief Queries the raw data chunk cache parameters + * + * \fapl_id{plist_id} + * \param[in,out] mdc_nelmts <i>No longer used</i> + * \param[in,out] rdcc_nslots Number of elements (objects) in the raw data + * chunk cache + * \param[in,out] rdcc_nbytes Total size of the raw data chunk cache, in + * bytes + * \param[in,out] rdcc_w0 Preemption policy + * + * \return \herr_t + * + * \details H5Pget_cache() retrieves the maximum possible number of + * elements in the raw data chunk cache, the maximum possible + * number of bytes in the raw data chunk cache, and the + * preemption policy value. + * + * Any (or all) arguments may be null pointers, in which case + * the corresponding datum is not returned. + * + * Note that the \p mdc_nelmts parameter is no longer used. + * + * \version 1.8.0 Use of the \p mdc_nelmts parameter discontinued. + * Metadata cache configuration is managed with + * H5Pset_mdc_config() and H5Pget_mdc_config() + * \version 1.6.0 The \p rdcc_nbytes and \p rdcc_nslots parameters changed + * from type int to size_t. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, /* out */ + size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, double *rdcc_w0); +/** + * \ingroup FAPL + * + * \brief Gets information about the write tracking feature used by + * the core VFD + * + * \fapl_id + * \param[out] is_enabled Whether the feature is enabled + * \param[out] page_size Size, in bytes, of write aggregation pages + * + * \return \herr_t + * + * \details H5Pget_core_write_tracking() retrieves information about the + * write tracking feature used by the core VFD. + * + * When a file is created or opened for writing using the core + * virtual file driver (VFD) with the backing store option turned + * on, the VFD can be configured to track changes to the file + * and only write out the modified bytes. To avoid a large number + * of small writes, the changes can be aggregated into pages of + * a user-specified size. The core VFD is also known as the + * memory VFD. The driver identifier is #H5FD_CORE. + * + * \note This function is only for use with the core VFD and must be used + * after the call to H5Pset_fapl_core(). It is an error to use this + * function with any other VFD. + * + * \note This function only applies to the backing store write operation + * which typically occurs when the file is flushed or closed. This + * function has no relationship to the increment parameter passed + * to H5Pset_fapl_core(). + * + * \note For optimum performance, the \p page_size parameter should be + * a power of two. + * + * \since 1.8.13 + * + */ +H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); +/** + * \ingroup FAPL + * + * \brief Returns low-lever driver identifier + * + * \plist_id + * + * \return \hid_t{low level driver} + * + * \details H5Pget_driver() returns the identifier of the low-level file + * driver associated with the file access property list or + * data transfer property list \p plist_id. + * + * Valid driver identifiers distributed with HDF5 are listed and + * described in the following table. + * + * <table> + * <tr> + * <th>Driver Name</th> + * <th>Driver Identifier</th> + * <th>Description</th> + * <th>Related Function</th> + * </tr> + * <tr> + * <td>POSIX</td> + * <td>#H5FD_SEC2</td> + * <td>This driver uses POSIX file-system functions like read and + * write to perform I/O to a single, permanent file on local disk + * with no system buffering. This driver is POSIX-compliant and + * is the default file driver for all systems.</td> + * <td>H5Pset_fapl_sec2()</td> + * </tr> + * <tr> + * <td>Direct</td> + * <td>#H5FD_DIRECT</td> + * <td>This is the #H5FD_SEC2 driver except data is written to or + * read from the file synchronously without being cached by the + * system.</td> + * <td>H5Pset_fapl_direct()</td> + * </tr> + * <tr> + * <td>Log</td> + * <td>#H5FD_LOG</td> + * <td>This is the #H5FD_SEC2 driver with logging capabilities.</td> + * <td>H5Pset_fapl_log()</td> + * </tr> + * <tr> + * <td>Windows</td> + * <td>#H5FD_WINDOWS</td> + * <td>This driver was modified in HDF5-1.8.8 to be a wrapper of the + * POSIX driver, #H5FD_SEC2. This change should not affect user + * applications.</td> + * <td>H5Pset_fapl_windows()</td> + * </tr> + * <tr> + * <td>STDIO</td> + * <td>#H5FD_STDIO</td> + * <td>This driver uses functions from the standard C stdio.h to + * perform I/O to a single, permanent file on local disk with + * additional system buffering.</td> + * <td>H5Pset_fapl_stdio()</td> + * </tr> + * <tr> + * <td>Memory</td> + * <td>#H5FD_CORE</td> + * <td>With this driver, an application can work with a file in + * memory for faster reads and writes. File contents are kept in + * memory until the file is closed. At closing, the memory + * version of the file can be written back to disk or abandoned. + * </td> + * <td>H5Pset_fapl_core()</td> + * </tr> + * <tr> + * <td>Family</td> + * <td>#H5FD_FAMILY</td> + * <td>With this driver, the HDF5 file’s address space is partitioned + * into pieces and sent to separate storage files using an + * underlying driver of the user’s choice. This driver is for + * systems that do not support files larger than 2 gigabytes. + * </td> + * <td>H5Pset_fapl_family()</td> + * </tr> + * <tr> + * <td>Multi</td> + * <td>#H5FD_MULTI</td> + * <td>With this driver, data can be stored in multiple files + * according to the type of the data. I/O might work better if + * data is stored in separate files based on the type of data. + * The Split driver is a special case of this driver.</td> + * <td>H5Pset_fapl_multi()</td> + * </tr> + * <tr> + * <td>Parallel</td> + * <td>#H5FD_MPIO</td> + * <td>This is the standard HDF5 file driver for parallel file + * systems. This driver uses the MPI standard for both + * communication and file I/O.</td> + * <td>H5Pset_fapl_mpio()</td> + * </tr> + * <tr> + * <td>Parallel POSIX</td> + * <td>H5FD_MPIPOSIX</td> + * <td>This driver is no longer available.</td> + * <td></td> + * </tr> + * <tr> + * <td>Stream</td> + * <td>H5FD_STREAM</td> + * <td>This driver is no longer available.</td> + * <td></td> + * </tr> + * </table> + * + * This list does not include custom drivers that might be + * defined and registered by a user. + * + * The returned driver identifier is only valid as long as the + * file driver remains registered. + * + * + * \since 1.4.0 + * + */ +H5_DLL hid_t H5Pget_driver(hid_t plist_id); +/** + * \ingroup FAPL + * + * \brief Returns a pointer to file driver information + * + * \param[in] plist_id File access or data transfer property list + * identifier + * + * \return Returns a pointer to a struct containing low-level driver + * information. Otherwise returns NULL. NULL is also returned if + * no driver-specific properties have been registered. No error + * is pushed on the stack in this case. + * + * \details H5Pget_driver_info() returns a pointer to file driver-specific + * information for the low-level driver associated with the file + * access or data transfer property list \p plist_id. + * + * The pointer returned by this function points to an “uncopied” + * struct. Driver-specific versions of that struct are defined + * for each low-level driver in the relevant source code file + * H5FD*.c. For example, the struct used for the MULTI driver is + * \c H5FD_multi_fapl_t defined in H5FDmulti.c. + * + * If no driver-specific properties have been registered, + * H5Pget_driver_info() returns NULL. + * + * \note H5Pget_driver_info() and H5Pset_driver() are used only when + * creating a virtual file driver (VFD) in the virtual file + * layer (VFL). + * + * \version 1.10.1 Return value was changed from \em void * to + * \em const \em void *. + * \version 1.8.2 Function publicized in this release; previous releases + * described this function only in the virtual file driver + * documentation. + * + */ H5_DLL const void *H5Pget_driver_info(hid_t plist_id); -H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); -H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); -H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); -H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); -H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); -H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); -H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type); -H5_DLL herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nslots, size_t rdcc_nbytes, - double rdcc_w0); -H5_DLL herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, /* out */ - size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, double *rdcc_w0); -H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); -H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); /* out */ -H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); -H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref /*out*/); -H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); -H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree); -H5_DLL herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size); -H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size /*out*/); -H5_DLL herr_t H5Pset_sieve_buf_size(hid_t fapl_id, size_t size); -H5_DLL herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size /*out*/); -H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size); -H5_DLL herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size /*out*/); -H5_DLL herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high); -H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high); -H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size); -H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size); -H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); -H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); -H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); -H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); -H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); -H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); -H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts); -H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts); -H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata); -H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata); -H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, - hbool_t start_on_access); -H5_DLL herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, - size_t *location_size, hbool_t *start_on_access); -H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); -H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); -H5_DLL herr_t H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled); +/** + * \ingroup FAPL + * + * \brief Retrieves the size of the external link open file cache + * + * \fapl_id{plist_id} + * \param[out] efc_size External link open file cache size in number of files + * + * \return \herr_t + * + * \details H5Pget_elink_file_cache_size() retrieves the number of files that + * can be held open in an external link open file cache. + * + * \since 1.8.7 + * + */ +H5_DLL herr_t H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size); +/** + * \ingroup FAPL + * + * \brief Retrieves the file access property list setting that determines + * whether an HDF5 object will be evicted from the library's metadata + * cache when it is closed + * + * \fapl_id + * \param[out] evict_on_close Pointer to a variable that will indicate if + * the object will be evicted on close + * + * \return \herr_t + * + * \details The library's metadata cache is fairly conservative about holding on + * to HDF5 object metadata (object headers, chunk index structures, + * etc.), which can cause the cache size to grow, resulting in memory + * pressure on an application or system. When enabled, the "evict on + * close" property will cause all metadata for an object to be + * immediately evicted from the cache as long as it is not referenced + * by any other open object. + * + * See H5Pset_evict_on_close() for additional notes on behavior. + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close); +/** + * \ingroup FAPL + * + * \brief Retrieves a data offset from the file access property list + * + * \fapl_id + * \param[out] offset Offset in bytes within the HDF5 file + * + * \return \herr_t + * + * \details H5Pget_family_offset() retrieves the value of offset from the + * file access property list \p fapl_id so that the user + * application can retrieve a file handle for low-level access to + * a particular member of a family of files. The file handle is + * retrieved with a separate call to H5Fget_vfd_handle() (or, + * in special circumstances, to H5FDget_vfd_handle(), see \ref VFL). + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); +/** + * \ingroup FAPL + * + * \brief Returns the file close degree + * + * \fapl_id + * \param[out] degree Pointer to a location to which to return the file + * close degree property, the value of \p degree + * + * \return \herr_t + * + * \details H5Pget_fclose_degree() returns the current setting of the file + * close degree property \p degree in the file access property + * list \p fapl_id. The value of \p degree determines how + * aggressively H5Fclose() deals with objects within a file that + * remain open when H5Fclose() is called to close that file. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree); +/** + * \ingroup FAPL + * + * \brief Retrieves a copy of the file image designated as the initial content + * and structure of a file + * + * \fapl_id + * \param[in,out] buf_ptr_ptr On input, \c NULL or a pointer to a + * pointer to a buffer that contains the + * file image.\n On successful return, if \p buf_ptr_ptr is not + * \c NULL, \Code{*buf_ptr_ptr} will contain a pointer to a copy + * of the initial image provided in the last call to + * H5Pset_file_image() for the supplied \p fapl_id. If no initial + * image has been set, \Code{*buf_ptr_ptr} will be \c NULL. + * \param[in,out] buf_len_ptr On input, \c NULL or a pointer to a buffer + * specifying the required size of the buffer to hold the file + * image.\n On successful return, if \p buf_len_ptr was not + * passed in as \c NULL, \p buf_len_ptr will return the required + * size in bytes of the buffer to hold the initial file image in + * the supplied file access property list, \p fapl_id. If no + * initial image is set, the value of \Code{*buf_len_ptr} will be + * set to 0 (zero) + * \return \herr_t + * + * \details H5Pget_file_image() allows an application to retrieve a copy of the + * file image designated for a VFD to use as the initial contents of a file. + * + * If file image callbacks are defined, H5Pget_file_image() will use + * them when allocating and loading the buffer to return to the + * application (see H5Pset_file_image_callbacks()). If file image + * callbacks are not defined, the function will use \c malloc and \c + * memcpy. When \c malloc and \c memcpy are used, it is the caller’s + * responsibility to discard the returned buffer with a call to \c + * free. + * + * It is the responsibility of the calling application to free the + * buffer whose address is returned in \p buf_ptr_ptr. This can be + * accomplished with \c free if file image callbacks have not been set + * (see H5Pset_file_image_callbacks()) or with the appropriate method + * if file image callbacks have been set. + * + * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), + * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), + * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, + * <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations"> + * HDF5 File Image Operations</a>. + * + * + * \since 1.8.9 + * + */ +H5_DLL herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); +/** + * \ingroup FAPL + * + * \brief Retrieves callback routines for working with file images + * + * \fapl_id + * \param[in,out] callbacks_ptr Pointer to the instance of the + * #H5FD_file_image_callbacks_t struct in which the callback + * routines are to be returned\n + * Struct fields must be initialized to NULL before the call + * is made.\n + * Struct field contents upon return will match those passed in + * in the last H5Pset_file_image_callbacks() call for the file + * access property list \p fapl_id. + * \return \herr_t + * + * \details H5Pget_file_image_callbacks() retrieves the callback routines set for + * working with file images opened with the file access property list + * \p fapl_id. + * + * The callbacks must have been previously set with + * H5Pset_file_image_callbacks() in the file access property list. + * + * Upon the successful return of H5Pset_file_image_callbacks(), the + * fields in the instance of the #H5FD_file_image_callbacks_t struct + * pointed to by \p callbacks_ptr will contain the same values as were + * passed in the most recent H5Pset_file_image_callbacks() call for the + * file access property list \p fapl_id. + * + * \see H5LTopen_file_image(), H5Fget_file_image(), H5Pset_file_image(), + * H5Pset_file_image_callbacks(), H5Pget_file_image_callbacks(), + * \ref H5FD_file_image_callbacks_t, \ref H5FD_file_image_op_t, + * <a href="https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations"> + * HDF5 File Image Operations</a>. + * + * \since 1.8.9 + * + */ +H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); +/** + * \ingroup FAPL + * + * \brief Retrieves the file locking property values + * + * \fapl_id + * \param[out] use_file_locking File locking flag + * \param[out] ignore_when_disabled Ignore when disabled flag + * \return \herr_t + * + * \details H5Pget_file_locking() retrieves the file locking property values for + * the file access property list specified by \p fapl_id. + * + * \since 1.10.7 + * + */ H5_DLL herr_t H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking, hbool_t *ignore_when_disabled); +/** + * \ingroup FAPL + * + * \brief Returns garbage collecting references setting + * + * \fapl_id + * \param[out] gc_ref Flag returning the state of reference garbage + * collection. A returned value of 1 indicates that + * garbage collection is on while 0 indicates that + * garbage collection is off. + * + * \return \herr_t + * + * \details H5Pget_gc_references() returns the current setting for the + * garbage collection references property from the specified + * file access property list. The garbage collection references + * property is set by H5Pset_gc_references(). + * + * \since 1.2.0 + * + */ +H5_DLL herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref /*out*/); +/** + * \ingroup FAPL + * + * \brief Retrieves library version bounds settings that indirectly control + * the format versions used when creating objects + * + * \fapl_id{plist_id} + * \param[out] low The earliest version of the library that will be used + * for writing objects + * \param[out] high The latest version of the library that will be used for + * writing objects + * + * \return \herr_t + * + * \details H5Pget_libver_bounds() retrieves the lower and upper bounds on + * the HDF5 library release versions that indirectly determine the + * object format versions used when creating objects in the file. + * + * This property is retrieved from the file access property list + * specified by the parameter \p fapl_id. + * + * The value returned in the parameters \p low and \p high is one + * of the enumerated values in the #H5F_libver_t struct, which is + * defined in H5Fpublic.h. + * + * \version 1.10.2 Add #H5F_LIBVER_V18 to the enumerated defines in + * #H5F_libver_t + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low, H5F_libver_t *high); +/** + * \ingroup FAPL + * + * \brief Get the current initial metadata cache configuration from the + * provided file access property list + * + * \fapl_id{plist_id} + * \param[in,out] config_ptr Pointer to the instance of #H5AC_cache_config_t + * in which the current metadata cache configuration is to be + * reported + * \return \herr_t + * + * \note The \c in direction applies only to the \ref H5AC_cache_config_t.version + * field. All other fields are \c out parameters. + * + * \details The fields of the #H5AC_cache_config_t structure are shown + * below: + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more + * + * H5Pget_mdc_config() gets the initial metadata cache configuration + * contained in a file access property list and loads it into the + * instance of #H5AC_cache_config_t pointed to by the \p config_ptr + * parameter. This configuration is used when the file is opened. + * + * Note that the version field of \Code{*config_ptr} must be + * initialized; this allows the library to support earlier versions of + * the #H5AC_cache_config_t structure. + * + * See the overview of the metadata cache in the special topics section + * of the user guide for details on the configuration data returned. If + * you haven't read and understood that documentation, the results of + * this call will not make much sense. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); /* out */ +/** + * \ingroup FAPL + * + * \brief Retrieves the metadata cache image configuration values for a file + * access property list + * + * \fapl_id{plist_id} + * \param[out] config_ptr Pointer to metadata cache image configuration values + * \return \herr_t + * + * \details H5Pget_mdc_image_config() retrieves the metadata cache image values + * into \p config_ptr for the file access property list specified in \p + * plist_id. + * + * #H5AC_cache_image_config_t is defined as follows: + * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip + * \click4more + * + * \since 1.10.1 + */ +H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); +/** + * \ingroup FAPL + * + * \brief Gets metadata cache logging options + * + * \fapl_id{plist_id} + * \param[out] is_enabled Flag whether logging is enabled + * \param[out] location Location of log in UTF-8/ASCII (file path/name) (On + * Windows, this must be ASCII) + * \param[out] location_size Size in bytes of the location string + * \param[out] start_on_access Whether the logging begins as soon as the file is + * opened or created + * \return \herr_t + * + * \details The metadata cache is a central part of the HDF5 library through + * which all file metadata reads and writes take place. File metadata + * is normally invisible to the user and is used by the library for + * purposes such as locating and indexing data. File metadata should + * not be confused with user metadata, which consists of attributes + * created by users and attached to HDF5 objects such as datasets via + * \ref H5A API calls. + * + * Due to the complexity of the cache, a trace/logging feature has been + * created that can be used by HDF5 developers for debugging and + * performance analysis. The functions that control this functionality + * will normally be of use to a very limited number of developers + * outside of The HDF Group. The functions have been documented to help + * users create logs that can be sent with bug reports. + * + * Control of the log functionality is straightforward. Logging is + * enabled via the H5Pset_mdc_log_options() function, which will modify + * the file access property list used to open or create a file. This + * function has a flag that determines whether logging begins at file + * open or starts in a paused state. Log messages can then be + * controlled via the H5Fstart_mdc_logging() / H5Fstop_mdc_logging() + * functions. H5Pget_mdc_log_options() can be used to examine a file + * access property list, and H5Fget_mdc_logging_status() will return + * the current state of the logging flags. + * + * The log format is described in the + * <a href="https://bit.ly/2PG6fNv">Metadata Cache Logging</a> document. + * + * \since 1.10.0 + */ +H5_DLL herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, + size_t *location_size, hbool_t *start_on_access); +/** + * \ingroup FAPL + * + * \brief Returns the current metadata block size setting + * + * \fapl_id{fapl_id} + * \param[out] size Minimum size, in bytes, of metadata block allocations + * + * \return \herr_t + * + * \details Returns the current minimum size, in bytes, of new + * metadata block allocations. This setting is retrieved from the + * file access property list \p fapl_id. + * + * This value is set by H5Pset_meta_block_size() and is + * retrieved from the file access property list \p fapl_id. + * + * \since 1.4.0 + */ +H5_DLL herr_t H5Pget_meta_block_size(hid_t fapl_id, hsize_t *size); +/** + * \ingroup FAPL + * + * \brief Retrieves the number of read attempts from a file access + * property list + * + * \fapl_id{plist_id} + * \param[out] attempts The number of read attempts + * + * \return \herr_t + * + * \details H5Pget_metadata_read_attempts() retrieves the number of read + * attempts that is set in the file access property list \p plist_id. + * + * For a default file access property list, the value retrieved + * will depend on whether the user sets the number of attempts via + * H5Pset_metadata_read_attempts(): + * + * <ul> + * + * <li>If the number of attempts is set to N, the value + * returned will be N. + * <li>If the number of attempts is not set, the value returned + * will be the default for non-SWMR access (1). SWMR is short + * for single-writer/multiple-reader. + * </ul> + * + * For the file access property list of a specified HDF5 file, + * the value retrieved will depend on how the file is opened + * and whether the user sets the number of read attempts via + * H5Pset_metadata_read_attempts(): + * + * <ul> + * <li>For a file opened with SWMR access: + * + * <ul> + * <li> If the number of attempts is set to N, the value + * returned will be N. + * <li> If the number of attempts is not set, the value + * returned will be the default for SWMR access (100). + * </ul> + * <li>For a file opened without SWMR access, the value + * retrieved will always be the default for non-SWMR access + * (1). The value set via H5Pset_metadata_read_attempts() does + * not have any effect on non-SWMR access. + * </ul> + * + * \par Failure Modes + * \parblock + * + * When the input property list is not a file access property list. + * + * When the library is unable to retrieve the number of read attempts from + * the file access property list. + * + * \endparblock + * + * \par Examples + * \parblock + * + * The first example illustrates the two cases for retrieving the number + * of read attempts from a default file access property list. + * + * \include H5Pget_metadata_read_attempts.1.c + * + * The second example illustrates the two cases for retrieving the + * number of read attempts from the file access property list of a file + * opened with SWMR acccess. + * + * \include H5Pget_metadata_read_attempts.2.c + * + * The third example illustrates the two cases for retrieving the number + * of read attempts from the file access property list of a file opened + * with non-SWMR acccess. + * + * \include H5Pget_metadata_read_attempts.3.c + * + * \endparblock + * + * \since 1.10.0 + */ +H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts); +/** + * \ingroup FAPL + * + * \brief Retrieves type of data property for MULTI driver + * + * \param[in] fapl_id File access property list or data transfer property + * list identifier + * \param[out] type Type of data + * + * \return \herr_t + * + * \details H5Pget_multi_type() retrieves the type of data setting from + * the file access or data transfer property list \p fapl_id. + * This enables a user application to specify the type of data + * the application wishes to access so that the application can + * retrieve a file handle for low-level access to the particular + * member of a set of MULTI files in which that type of data is + * stored. The file handle is retrieved with a separate call to + * H5Fget_vfd_handle() (or, in special circumstances, to + * H5FDget_vfd_handle(); see the Virtual File Layer documentation + * for more information. + * + * The type of data returned in \p type will be one of those + * listed in the discussion of the \p type parameter in the the + * description of the function H5Pset_multi_type(). + * + * Use of this function is only appropriate for an HDF5 file + * written as a set of files with the MULTI file driver. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type); +/** + * \ingroup FAPL + * + * \brief Retrieves the object flush property values from the file access property list + * + * \fapl_id{plist_id} + * \param[in] func The user-defined callback function + * \param[in] udata The user-defined input data for the callback function + * + * \return \herr_t + * + * \details H5Pget_object_flush_cb() gets the user-defined callback + * function that is set in the file access property list + * \p fapl_id and stored in the parameter \p func. The callback is + * invoked whenever an object flush occurs in the file. This + * routine also obtains the user-defined input data that is + * passed along to the callback function in the parameter + * \p udata. + * + * \par Example + * \parblock + * The example below illustrates the usage of this routine to obtain the + * object flush property values. + * + * \include H5Pget_object_flush_cb.c + * \endparblock + * + * \since 1.10.0 + */ +H5_DLL herr_t H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func, void **udata); +/** + * \ingroup FAPL + * + * \brief Retrieves the maximum size for the page buffer and the minimum + percentage for metadata and raw data pages + * + * \fapl_id{plist_id} + * \param[out] buf_size Maximum size, in bytes, of the page buffer + * \param[out] min_meta_perc Minimum metadata percentage to keep in the + * page buffer before allowing pages containing metadata to + * be evicted + * + * \param[out] min_raw_perc Minimum raw data percentage to keep in the + * page buffer before allowing pages containing raw data to + * be evicted + * + * \return \herr_t + * + * \details H5Pget_page_buffer_size() retrieves \p buf_size, the maximum + * size in bytes of the page buffer, \p min_meta_perc, the + * minimum metadata percentage, and \p min_raw_perc, the + * minimum raw data percentage. + * + * \since 1.10.1 + */ +H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_perc, + unsigned *min_raw_perc); +/** + * \ingroup FAPL + * + * \brief Returns maximum data sieve buffer size + * + * \fapl_id{fapl_id} + * \param[in] size Maximum size, in bytes, of data sieve buffer + * + * \return \herr_t + * + * \details H5Pget_sieve_buf_size() retrieves, size, the current maximum + * size of the data sieve buffer. + * + * This value is set by H5Pset_sieve_buf_size() and is retrieved + * from the file access property list fapl_id. + * + * \version 1.6.0 The \p size parameter has changed from type \c hsize_t + * to \c size_t + * \since 1.4.0 + */ +H5_DLL herr_t H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size /*out*/); +/** + * \ingroup FAPL + * + * \brief Retrieves the current small data block size setting + * + * \fapl_id{fapl_id} + * \param[out] size Maximum size, in bytes, of the small data block + * + * \result \herr_t + * + * \details H5Pget_small_data_block_size() retrieves the current setting + * for the size of the small data block. + * + * If the returned value is zero (0), the small data block + * mechanism has been disabled for the file. + * + * \since 1.4.4 + */ +H5_DLL herr_t H5Pget_small_data_block_size(hid_t fapl_id, hsize_t *size /*out*/); +/** + * \ingroup FAPL + * + * \brief Returns the identifier of the current VOL connector + * + * \fapl_id{plist_id} + * \param[out] vol_id Current VOL connector identifier + * + * \return \herr_t + * + * \details H5Pget_vol_id() returns the VOL connector identifier \p vol_id for + * the file access property list \p plist_id. This identifier should + * be closed with H5VLclose(). + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); +/** + * \ingroup FAPL + * + * \brief Returns a copy of the VOL information for a connector + * + * \fapl_id{plist_id} + * \param[out] vol_info The VOL information for a connector + * + * \return \herr_t + * + * \details H5Pget_vol_info() returns a copy of the VOL information \p vol_info + * for a connector specified by the file access property list + * \p plist_id. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); +/** + * \ingroup FAPL + * + * \brief Sets alignment properties of a file access property list + * + * \fapl_id + * \param[in] threshold Threshold value. Note that setting the threshold + * value to 0 (zero) has the effect of a special case, + * forcing everything to be aligned + * \param[in] alignment Alignment value + * + * \return \herr_t + * + * \details H5Pset_alignment() sets the alignment properties of a + * file access property list so that any file object greater + * than or equal in size to \p threshold bytes will be aligned + * on an address which is a multiple of \p alignment. The + * addresses are relative to the end of the user block; the + * alignment is calculated by subtracting the user block size + * from the absolute file address and then adjusting the address + * to be a multiple of \p alignment. + * + * Default values for \p threshold and \p alignment are one, + * implying no alignment. Generally the default values will + * result in the best performance for single-process access to + * the file. For MPI IO and other parallel systems, choose an + * alignment which is a multiple of the disk block size. + * + * If the file space handling strategy is set to + * #H5F_FSPACE_STRATEGY_PAGE, then the alignment set via this + * routine is ignored. The file space handling strategy is set + * by H5Pset_file_space_strategy(). + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment); +/** + * \ingroup FAPL + * + * \brief Sets the raw data chunk cache parameters + * + * \fapl_id{plist_id} + * \param[in] mdc_nelmts No longer used; any value passed is ignored + * \param[in] rdcc_nslots The number of chunk slots in the raw data chunk + * cache for this dataset. Increasing this value + * reduces the number of cache collisions, but + * slightly increases the memory used. Due to the + * hashing strategy, this value should ideally be a + * prime number. As a rule of thumb, this value + * should be at least 10 times the number of chunks + * that can fit in \p rdcc_nbytes bytes. For + * maximum performance, this value should be set + * approximately 100 times that number of chunks. + * The default value is 521. + * \param[in] rdcc_nbytes Total size of the raw data chunk cache in bytes. + * The default size is 1 MB per dataset. + * \param[in] rdcc_w0 The chunk preemption policy for all datasets. + * This must be between 0 and 1 inclusive and + * indicates the weighting according to which chunks + * which have been fully read or written are + * penalized when determining which chunks to flush + * from cache. A value of 0 means fully read or + * written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) + * while a value of 1 means fully read or written + * chunks are always preempted before other chunks. + * If your application only reads or writes data once, + * this can be safely set to 1. Otherwise, this should + * be set lower depending on how often you re-read or + * re-write the same data. The default value is 0.75. + * If the value passed is #H5D_CHUNK_CACHE_W0_DEFAULT, + * then the property will not be set on the dataset + * access property list, and the parameter will come + * from the file access property list. + * + * \return \herr_t + * + * \details H5Pset_cache() sets the number of elements, the total number of + * bytes, and the preemption policy value for all datasets in a file + * on the file’s file access property list. + * + * The raw data chunk cache inserts chunks into the cache by first + * computing a hash value using the address of a chunk and then by + * using that hash value as the chunk’s index into the table of + * cached chunks. In other words, the size of this hash table and the + * number of possible hash values is determined by the \p rdcc_nslots + * parameter. If a different chunk in the cache has the same hash value, + * a collision will occur, which will reduce efficiency. If inserting + * the chunk into the cache would cause the cache to be too big, then + * the cache will be pruned according to the \p rdcc_w0 parameter. + * + * The \p mdc_nelmts parameter is no longer used; any value passed + * in that parameter will be ignored. + * + * \b Motivation: Setting raw data chunk cache parameters + * can be done with H5Pset_cache(), H5Pset_chunk_cache(), + * or a combination of both. H5Pset_cache() is used to + * adjust the chunk cache parameters for all datasets via + * a global setting for the file, and H5Pset_chunk_cache() + * is used to adjust the chunk cache parameters for + * individual datasets. When both are used, parameters + * set with H5Pset_chunk_cache() will override any parameters + * set with H5Pset_cache(). + * + * \note Optimum chunk cache parameters may vary widely depending + * on different data layout and access patterns. For datasets + * with low performance requirements for example, changing + * the cache settings can save memory. + * + * \note Note: Raw dataset chunk caching is not currently + * supported when using the MPI I/O and MPI POSIX file drivers + * in read/write mode; see H5Pset_fapl_mpio() and + * H5Pset_fapl_mpiposix(), respectively. When using one of these + * file drivers, all calls to H5Dread() and H5Dwrite() will access + * the disk directly, and H5Pset_cache() will have no effect on + * performance. + * + * \note Raw dataset chunk caching is supported when these drivers are + * used in read-only mode. + * + * \todo Check on H5Pset_fapl_mpio() and H5Pset_fapl_mpiposix(). + * + * \version 1.8.0 The use of the \p mdc_nelmts parameter was discontinued. + * Metadata cache configuration is managed with + * H5Pset_mdc_config() and H5Pget_mdc_config(). + * \version 1.6.0 The \p rdcc_nbytes and \p rdcc_nelmts parameters + * changed from type int to size_t. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_cache(hid_t plist_id, int mdc_nelmts, size_t rdcc_nslots, size_t rdcc_nbytes, + double rdcc_w0); +/** + * \ingroup FAPL + * + * \brief Sets write tracking information for core driver, #H5FD_CORE + * + * \fapl_id{fapl_id} + * \param[in] is_enabled Boolean value specifying whether feature is + enabled + * \param[in] page_size Positive integer specifying size, in bytes, of + * write aggregation pages Value of 1 (one) enables + * tracking with no paging. + * + * \return \herr_t + * + * \details When a file is created or opened for writing using the core + * virtual file driver (VFD) with the backing store option + * turned on, the core driver can be configured to track + * changes to the file and write out only the modified bytes. + * + * This write tracking feature is enabled and disabled with \p + * is_enabled. The default setting is that write tracking is + * disabled, or off. + * + * To avoid a large number of small writes, changes can + * be aggregated into pages of a user-specified size, \p + * page_size. + * + * Setting \p page_size to 1 enables tracking with no page + * aggregation. + * + * The backing store option is set via the function + * H5Pset_fapl_core. + * + * \attention + * \parblock + * This function is only for use with the core VFD and must + * be used after the call to H5Pset_fapl_core(). It is an error + * to use this function with any other VFD. + * + * It is an error to use this function when the backing store + * flag has not been set using H5Pset_fapl_core(). + * + * This function only applies to the backing store write + * operation which typically occurs when the file is flushed + * or closed. This function has no relationship to the + * increment parameter passed to H5Pset_fapl_core(). + * + * For optimum performance, the \p page_size parameter should be + * a power of two. + * + * It is an error to set the page size to 0. + * \endparblock + * + * \version 1.8.14 C function modified in this release to return error + * if \p page_size is set to 0 (zero). + * \since 1.8.13 + * + */ +H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); +/** + * \ingroup FAPL + * + * \brief Sets a file driver + * + * \plist_id + * \param[in] driver_id The new driver identifier + * \param[in] driver_info Optional struct containing driver properties + * + * \return \herr_t + * + * \details H5Pset_driver() sets the file driver, driver_id, for a file + * access or data transfer property list, \p plist_id, and + * supplies an optional struct containing the driver-specific + * properties, \p driver_info. + * + * The driver properties will be copied into the property list + * and the reference count on the driver will be incremented, + * allowing the caller to close the driver identifier but still + * use the property list. + * + * \version 1.8.2 Function publicized in this release; previous releases + * described this function only in the virtual file driver + * documentation. + * + */ +H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); +/** + * \ingroup FAPL + * + * \brief Sets the number of files that can be held open in an external + * link open file cache + * + * \par Motivation + * \parblock + * The <em>external link open file cache</em> holds files open after + * they have been accessed via an external link. This cache reduces + * the number of times such files are opened when external links are + * accessed repeatedly and can siginificantly improves performance in + * certain heavy-use situations and when low-level file opens or closes + * are expensive. + * + * H5Pset_elink_file_cache_size() sets the number of files + * that will be held open in an external link open file + * cache. H5Pget_elink_file_cache_size() retrieves the size of an existing + * cache; and H5Fclear_elink_file_cache() clears an existing cache without + * closing it. + * \endparblock + * + * \fapl_id{plist_id} + * \param[in] efc_size External link open file cache size in number of files + * <em>Default setting is 0 (zero).</em> + * + * \return \herr_t + * + * \details H5Pset_elink_file_cache_size() specifies the number of files + * that will be held open in an external link open file cache. + * + * The default external link open file cache size is 0 (zero), + * meaning that files accessed via an external link are not + * held open. Setting the cache size to a positive integer + * turns on the cache; setting the size back to zero turns it + * off. + * + * With this property set, files are placed in the external + * link open file cache cache when they are opened via an + * external link. Files are then held open until either + * they are evicted from the cache or the parent file is + * closed. This property setting can improve performance when + * external links are repeatedly accessed. + * + * When the cache is full, files will be evicted using a least + * recently used (LRU) scheme; the file which has gone the + * longest time without being accessed through the parent file + * will be evicted and closed if nothing else is holding that + * file open. + * + * Files opened through external links inherit the parent + * file’s file access property list by default, and therefore + * inherit the parent file’s external link open file cache + * setting. + * + * When child files contain external links of their own, the + * caches can form a graph of cached external files. Closing + * the last external reference to such a graph will recursively + * close all files in the graph, even if cycles are present. + * \par Example + * \parblock + * The following code sets up an external link open file cache that will + * hold open up to 8 files reached through external links: + * + * \code + * status = H5Pset_elink_file_cache_size(fapl_id, 8); + * \endcode + * \endparblock + * + * \since 1.8.7 + */ +H5_DLL herr_t H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size); +/** + * \ingroup FAPL + * + * \brief Controls the library's behavior of evicting metadata associated with + * a closed object + * + * \fapl_id + * \param[in] evict_on_close Whether the HDF5 object should be evicted on close + * + * \return \herr_t + * + * \details The library's metadata cache is fairly conservative about holding + * on to HDF5 object metadata(object headers, chunk index structures, + * etc.), which can cause the cache size to grow, resulting in memory + * pressure on an application or system. When enabled, the "evict on + * close" property will cause all metadata for an object to be evicted + * from the cache as long as metadata is not referenced by any other + * open object. + * + * This function only applies to file access property lists. + * + * The default library behavior is to not evict on object or file + * close. + * + * When applied to a file access property list, any subsequently opened + * object will inherit the "evict on close" property and will have + * its metadata evicted when the object is closed. + * + * \since 1.10.1 + * + */ +H5_DLL herr_t H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close); +/** + * \ingroup FAPL + * + * \brief Sets offset property for low-level access to a file in a family of + * files + * + * \fapl_id + * \param[in] offset Offset in bytes within the HDF5 file + * + * \return \herr_t + * + * \details H5Pset_family_offset() sets the offset property in the file access + * property list \p fapl_id so that the user application can + * retrieve a file handle for low-level access to a particular member + * of a family of files. The file handle is retrieved with a separate + * call to H5Fget_vfd_handle() (or, in special circumstances, to + * H5FDget_vfd_handle(); see \ref VFL). + * + * The value of \p offset is an offset in bytes from the beginning of + * the HDF5 file, identifying a user-determined location within the + * HDF5 file. + * The file handle the user application is seeking is for the specific + * member-file in the associated family of files to which this offset + * is mapped. + * + * Use of this function is only appropriate for an HDF5 file written as + * a family of files with the \c FAMILY file driver. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); +/** + * \ingroup FAPL + * + * \brief Sets the file close degree + * + * \fapl_id + * \param[in] degree Pointer to a location containing the file close + * degree property, the value of \p degree + * + * \return \herr_t + * + * \details H5Pset_fclose_degree() sets the file close degree property + * \p degree in the file access property list \p fapl_id. + * + * The value of \p degree determines how aggressively + * H5Fclose() deals with objects within a file that remain open + * when H5Fclose() is called to close that file. \p degree can + * have any one of four valid values: + * + * <table> + * <tr> + * <th>Degree name</th> + * <th>H5Fclose behavior with no open object in file</th> + * <th>H5Fclose behavior with open object(s) in file</th> + * </tr> + * <tr> + * <td>#H5F_CLOSE_WEAK</td> + * <td>Actual file is closed.</td> + * <td>Access to file identifier is terminated; actual file + * close is delayed until all objects in file are closed + * </td> + * </tr> + * <tr> + * <td>#H5F_CLOSE_SEMI</td> + * <td>Actual file is closed.</td> + * <td>Function returns FAILURE</td> + * </tr> + * <tr> + * <td>#H5F_CLOSE_STRONG</td> + * <td>Actual file is closed.</td> + * <td>All open objects remaining in the file are closed then + * file is closed</td> + * </tr> + * <tr> + * <td>#H5F_CLOSE_DEFAULT</td> + * <td>The VFL driver chooses the behavior. Currently, all VFL + * drivers set this value to #H5F_CLOSE_WEAK, except for the + * MPI-I/O driver, which sets it to #H5F_CLOSE_SEMI.</td> + * <td></td> + * </tr> + * + * </table> + * \warning If a file is opened multiple times without being closed, each + * open operation must use the same file close degree setting. + * For example, if a file is already open with #H5F_CLOSE_WEAK, + * an H5Fopen() call with #H5F_CLOSE_STRONG will fail. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree); +/** + * \ingroup FAPL + * + * \brief Sets an initial file image in a memory buffer + * + * \fapl_id + * \param[in] buf_ptr Pointer to the initial file image, or + * NULL if no initial file image is desired + * \param[in] buf_len Size of the supplied buffer, or + * 0 (zero) if no initial image is desired + * + * \return \herr_t + * + * \details H5Pset_file_image() allows an application to provide a file image + * to be used as the initial contents of a file. + * Calling H5Pset_file_image()makes a copy of the buffer specified in + * \p buf_ptr of size \p buf_len. + * + * \par Motivation: + * H5Pset_file_image() and other elements of HDF5 are + * used to load an image of an HDF5 file into system memory and open + * that image as a regular HDF5 file. An application can then use the + * file without the overhead of disk I/O. + * + * \par Recommended Reading: + * This function is part of the file image + * operations feature set. It is highly recommended to study the guide + * [<em>HDF5 File Image Operations</em>] + * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations + * ) before using this feature set. See the “See Also” section below + * for links to other elements of HDF5 file image operations. + * + * \see + * \li H5LTopen_file_image() + * \li H5Fget_file_image() + * \li H5Pget_file_image() + * \li H5Pset_file_image_callbacks() + * \li H5Pget_file_image_callbacks() + * + * \li [HDF5 File Image Operations] + * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations) + * in [Advanced Topics in HDF5] + * (https://portal.hdfgroup.org/display/HDF5/Advanced+Topics+in+HDF5) + * + * \li Within H5Pset_file_image_callbacks(): + * \li Callback #H5FD_file_image_callbacks_t + * \li Callback #H5FD_file_image_op_t + * + * \version 1.8.13 Fortran subroutine added in this release. + * \since 1.8.9 + * + */ +H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); +/** + * \ingroup FAPL + * + * \brief Sets the callbacks for working with file images + * + * \note **Motivation:** H5Pset_file_image_callbacks() and other elements + * of HDF5 are used to load an image of an HDF5 file into system + * memory and open that image as a regular HDF5 file. An application + * can then use the file without the overhead of disk I/O.\n + * **Recommended Reading:** This function is part of the file + * image operations feature set. It is highly recommended to study + * the guide [HDF5 File Image Operations] + * (https://portal.hdfgroup.org/display/HDF5/HDF5+File+Image+Operations + * ) before using this feature set. See the “See Also” section below + * for links to other elements of HDF5 file image operations. + * + * \fapl_id + * \param[in,out] callbacks_ptr Pointer to the instance of the + * #H5FD_file_image_callbacks_t structure + * + * \return \herr_t \n + * **Failure Modes**: Due to interactions between this function and + * H5Pset_file_image() and H5Pget_file_image(), + * H5Pset_file_image_callbacks() will fail if a file image has + * already been set in the target file access property list, \p fapl_id. + * + * \details H5Pset_file_image_callbacks() sets callback functions for working + * with file images in memory. + * + * H5Pset_file_image_callbacks() allows an application to control the + * management of file image buffers through user defined callbacks. + * These callbacks can be used in the management of file image buffers + * in property lists and with certain file drivers. + * + * H5Pset_file_image_callbacks() must be used before any file image has + * been set in the file access property list. Once a file image has + * been set, the function will fail. + * + * The callback routines set up by H5Pset_file_image_callbacks() are + * invoked when a new file image buffer is allocated, when an existing + * file image buffer is copied or resized, or when a file image buffer + * is released from use. + * + * Some file drivers allow the use of user-defined callback functions + * for allocating, freeing, and copying the driver’s internal buffer, + * potentially allowing optimizations such as avoiding large \c malloc + * and \c memcpy operations, or to perform detailed logging. + * + * From the perspective of the HDF5 library, the operations of the + * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc", + * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy", + * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks + * must be identical to those of the + * corresponding C standard library calls (\c malloc, \c memcpy, + * \c realloc, and \c free). While the operations must be identical, + * the file image callbacks have more parameters. The return values + * of \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and + * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" are identical to + * the return values of \c malloc and \c realloc. The return values of + * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" differ from the return + * values of \c memcpy and \c free in that the return values of + * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" can also indicate failure. + * + * The callbacks and their parameters, along with a struct and + * an \c ENUM required for their use, are described below. + * + * <b>Callback struct and \c ENUM:</b> + * + * The callback functions set up by H5Pset_file_image_callbacks() use + * a struct and an \c ENUM that are defined as follows + * + * The struct #H5FD_file_image_callbacks_t serves as a container + * for the callback functions and a pointer to user-supplied data. + * The struct is defined as follows: + * \snippet H5FDpublic.h H5FD_file_image_callbacks_t_snip + * + * Elements of the #H5FD_file_image_op_t are used by the + * callbacks to invoke certain operations on file images. The ENUM is + * defined as follows: + * \snippet H5FDpublic.h H5FD_file_image_op_t_snip + * + * The elements of the #H5FD_file_image_op_t are used in the following + * callbacks: + * + * - The \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc" callback + * contains a pointer to a function that must appear to HDF5 to have + * functionality identical to that of the standard C library \c malloc() call. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_malloc_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" + * callback contains a pointer to a function + * that must appear to HDF5 to have functionality identical to that + * of the standard C library \c memcopy() call, except that it returns + * a \p NULL on failure. (The \c memcpy C Library routine is defined + * to return the \p dest parameter in all cases.) + * + * - Setting \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy" + * to \c NULL indicates that HDF5 should invoke + * the standard C library \c memcpy() routine when copying buffers. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_memcpy_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" callback + * contains a pointer to a function that must appear to HDF5 to have + * functionality identical to that of the standard C library \c realloc() call. + * + * - Setting \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc" + * to \p NULL indicates that HDF5 should + * invoke the standard C library \c realloc() routine when resizing + * file image buffers. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_realloc_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.image_free "image_free" callback contains + * a pointer to a function that must appear to HDF5 to have functionality + * identical to that of the standard C library \c free() call, except + * that it will return \c 0 (\c SUCCEED) on success and \c -1 (\c FAIL) on failure. + * + * - Setting \ref H5FD_file_image_callbacks_t.image_free "image_free" + * to \c NULL indicates that HDF5 should invoke + * the standard C library \c free() routine when releasing file image + * buffers. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h image_free_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.udata_copy "udata_copy" + * callback contains a pointer to a function + * that, from the perspective of HDF5, allocates a buffer of suitable + * size, copies the contents of the supplied \p udata into the new + * buffer, and returns the address of the new buffer. The function + * returns NULL on failure. This function is necessary if a non-NULL + * \p udata parameter is supplied, so that property lists containing + * the image callbacks can be copied. If the \p udata parameter below + * is \c NULL, then this parameter should be \c NULL as well. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h udata_copy_snip + * \n + * - The \ref H5FD_file_image_callbacks_t.udata_free "udata_free" + * callback contains a pointer to a function + * that, from the perspective of HDF5, frees a user data block. This + * function is necessary if a non-NULL udata parameter is supplied so + * that property lists containing image callbacks can be discarded + * without a memory leak. If the udata parameter below is \c NULL, + * this parameter should be \c NULL as well. + * + * - Signature in #H5FD_file_image_callbacks_t: + * \snippet H5FDpublic.h udata_free_snip + * + * - \p **udata**, the final field in the #H5FD_file_image_callbacks_t + * struct, provides a pointer to user-defined data. This pointer will + * be passed to the + * \ref H5FD_file_image_callbacks_t.image_malloc "image_malloc", + * \ref H5FD_file_image_callbacks_t.image_memcpy "image_memcpy", + * \ref H5FD_file_image_callbacks_t.image_realloc "image_realloc", and + * \ref H5FD_file_image_callbacks_t.image_free "image_free" callbacks. + * Define udata as \c NULL if no user-defined data is provided. + * + * \since 1.8.9 + * + */ +H5_DLL herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); +/** + * \ingroup FAPL + * + * \brief Sets the file locking property values + * + * \fapl_id + * \param[in] use_file_locking Toggle to specify file locking (or not) + * \param[in] ignore_when_disabled Toggle to ignore when disabled (or not) + * + * \return \herr_t + * + * \details H5Pset_file_locking() overrides the default file locking flag + * setting that was set when the library was configured. + * + * This setting can be overridden by the \c HDF5_USE_FILE_LOCKING + * environment variable. + * + * File locking is used when creating/opening a file to prevent + * problematic file accesses. + * + * \since 1.10.7 + * + */ +H5_DLL herr_t H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when_disabled); +/** + * \ingroup FAPL + * + * \brief Sets garbage collecting references flag + * + * \fapl_id + * \param[in] gc_ref Flag setting reference garbage collection to on (1) or off (0) + * + * \return \herr_t + * + * \details H5Pset_gc_references() sets the flag for garbage collecting + * references for the file. + * + * Dataset region references and other reference types use space in an + * HDF5 file's global heap. If garbage collection is on and the user + * passes in an uninitialized value in a reference structure, the heap + * might get corrupted. When garbage collection is off, however, and + * the user re-uses a reference, the previous heap block will be + * orphaned and not returned to the free heap space. + * + * When garbage collection is on, the user must initialize the + * reference structures to 0 or risk heap corruption. + * + * The default value for garbage collecting references is off. + * + */ +H5_DLL herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref); +/** + * \ingroup FAPL + * + * \brief Controls the range of library release versions used when creating + * objects in a file + * + * \fapl_id{plist_id} + * \param[in] low The earliest version of the library that will be used + * for writing objects + * \param[in] high The latest version of the library that will be used for + * writing objects + * + * \return \herr_t + * + * \details H5Pset_libver_bounds() controls the range of library release + * versions that will be used when creating objects in a file. + * The object format versions are determined indirectly from the + * library release versions specified in the call. + * + * This property is set in the file access property list + * specified by the parameter \p fapl_id. + * + * The parameter \p low sets the earliest possible format + * versions that the library will use when creating objects in + * the file. Note that earliest possible is different from + * earliest, as some features introduced in library versions + * later than 1.0.0 resulted in updates to object formats. + * The parameter \p high sets the latest format versions that + * the library will be allowed to use when creating objects in + * the file. + * + * The parameters \p low and \p high must be one of the + * enumerated values in the #H5F_libver_t struct, which is + * defined in H5Fpublic.h. + * + * The macro #H5F_LIBVER_LATEST is aliased to the highest + * enumerated value in #H5F_libver_t, indicating that this is + * currently the latest format available. + * + * The library supports the following five pairs of + * (\p low, \p high) combinations as derived from the values + * in #H5F_libver_t: + * + * <table> + * <tr> + * <th>Value of \p low and \p high</th> + * <th>Result</th> + * </tr> + * <tr> + * <td>\p low=#H5F_LIBVER_EARLIEST<br /> + * \p high=#H5F_LIBVER_V18</td> + * <td> + * \li The library will create objects with the earliest + * possible format versions. + * \li The library will allow objects to be created with the + * latest format versions available to library release 1.8.x. + * \li API calls that create objects or features that are + * available to versions of the library greater than 1.8.x + * release will fail. + * </td> + * </tr> + * <tr> + * <td>\p low=#H5F_LIBVER_EARLIEST<br /> + * \p high=#H5F_LIBVER_V110</td> + * <td> + * \li The library will create objects with the earliest possible + * format versions. + * \li The library will allow objects to be created with the latest + * format versions available to library release 1.10.x. + * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper + * limit on the format versions to use. For example, if a newer + * format version is required to support a feature e.g. virtual + * dataset, this setting will allow the object to be created. + * \li This is the library default setting and provides the greatest + * format compatibility. + * </td> + * </tr> + * <tr> + * <td>\p low=#H5F_LIBVER_V18<br /> + * \p high=#H5F_LIBVER_V18</td> + * <td> + * \li The library will create objects with the latest format + * versions available to library release 1.8.x. + * \li API calls that create objects or features that are available + * to versions of the library greater than 1.8.x release will + * fail. + * \li Earlier versions of the library may not be able to access + * objects created with this setting.</td> + * </tr> + * <tr> + * <td>\p low=#H5F_LIBVER_V18<br /> + * \p high=#H5F_LIBVER_V110</td> + * <td> + * \li The library will create objects with the latest format + * versions available to library release 1.8.x. + * \li The library will allow objects to be created with the latest + * format versions available to library release 1.10.x. + * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper + * limit on the format versions to use. For example, if a + * newer format version is required to support a feature e.g. + * virtual dataset, this setting will allow the object to be + * created. + * \li Earlier versions of the library may not be able to access + * objects created with this setting.</td> + * </tr> + * <tr> + * <td>\p low=#H5F_LIBVER_V110<br /> + * \p high=#H5F_LIBVER_V110 + * </td> + * <td> + * \li The library will create objects with the latest format + * versions available to library release 1.10.x. + * \li The library will allow objects to be created with the latest + * format versions available to library release 1.10.x. + * Since 1.10.x is also #H5F_LIBVER_LATEST, there is no upper + * limit on the format versions to use. For example, if a + * newer format version is required to support a feature e.g. + * virtual dataset, this setting will allow the object to be + * created. + * \li This setting allows users to take advantage of the latest + * features and performance enhancements in the library. + * However, objects written with this setting may be + * accessible to a smaller range of library versions than + * would be the case if low is set to #H5F_LIBVER_EARLIEST. + * \li Earlier versions of the library may not be able to access + * objects created with this + * setting. + * </td> + * </tr> + * </table> + * + * \version 1.10.2 #H5F_LIBVER_V18 added to the enumerated defines in + * #H5F_libver_t. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high); +/** + * \ingroup FAPL + * + * \brief Set the initial metadata cache configuration in the indicated File + * Access Property List to the supplied value + * + * \fapl_id{plist_id} + * \param[in] config_ptr Pointer to the instance of \p H5AC_cache_config_t + * containing the desired configuration + * \return \herr_t + * + * \details The fields of the #H5AC_cache_config_t structure are shown + * below: + * \snippet H5ACpublic.h H5AC_cache_config_t_snip + * \click4more + * + * \details H5Pset_mdc_config() attempts to set the initial metadata cache + * configuration to the supplied value. It will fail if an invalid + * configuration is detected. This configuration is used when the file + * is opened. + * + * See the overview of the metadata cache in the special topics section + * of the user manual for details on what is being configured. If you + * have not read and understood that documentation, you really should + * not be using this API call. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr); +/** + * \ingroup FAPL + * + * \brief Sets metadata cache logging options + * + * \fapl_id{plist_id} + * \param[in] is_enabled Whether logging is enabled + * \param[in] location Location of log in UTF-8/ASCII (file path/name) + * (On Windows, this must be ASCII) + * \param[in] start_on_access Whether the logging will begin as soon as the + * file is opened or created + * + * \return \herr_t + * + * \details The metadata cache is a central part of the HDF5 library through + * which all file metadata reads and writes take place. File metadata + * is normally invisible to the user and is used by the library for + * purposes such as locating and indexing data. File metadata should + * not be confused with user metadata, which consists of attributes + * created by users and attached to HDF5 objects such as datasets via + * H5A API calls. + * + * Due to the complexity of the cache, a trace/logging feature has + * been created that can be used by HDF5 developers for debugging and + * performance analysis. The functions that control this functionality + * will normally be of use to a very limited number of developers + * outside of The HDF Group. The functions have been documented to + * help users create logs that can be sent with bug reports. + * + * Control of the log functionality is straightforward. Logging is + * enabled via the H5Pset_mdc_log_options() function, + * which will modify the file access property list used to open or + * create a file. This function has a flag that determines whether + * logging begins at file open or starts in a paused state. Log + * messages can then be controlled via the H5Fstart_mdc_logging() + * and H5Fstop_mdc_logging() function. + * + * H5Pget_mdc_log_options() can be used to examine a file access + * property list, and H5Fget_mdc_logging_status() will return the + * current state of the logging flags. + * + * The log format is described in [<em>Metadata Cache Logging</em>] + * (https://portal.hdfgroup.org/display/HDF5/Fine-tuning+the+Metadata+Cache). + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, + hbool_t start_on_access); +/** + * \ingroup FAPL + * + * \brief Sets the minimum metadata block size + * + * \fapl_id{fapl_id} + * \param[in] size Minimum size, in bytes, of metadata block allocations + * + * \return \herr_t + * + * \details H5Pset_meta_block_size() sets the minimum size, in bytes, of + * metadata block allocations when #H5FD_FEAT_AGGREGATE_METADATA is set by a VFL + * driver. + + * Each raw metadata block is initially allocated to be of the given size. + * Specific metadata objects (e.g., object headers, local heaps, B-trees) are then + * sub-allocated from this block. + * + * The default setting is 2048 bytes, meaning that the library will + * attempt to aggregate metadata in at least 2K blocks in the file. + * Setting the value to zero (\Code{0}) with this function will turn + * off metadata aggregation, even if the VFL driver attempts to use the + * metadata aggregation strategy. + * + * Metadata aggregation reduces the number of small data objects in the file that + * would otherwise be required for metadata. The aggregated block of metadata is + * usually written in a single write action and always in a contiguous block, + * potentially significantly improving library and application performance. + * + * \since 1.4.0 + */ +H5_DLL herr_t H5Pset_meta_block_size(hid_t fapl_id, hsize_t size); +/** + * \ingroup FAPL + * + * \brief Sets the number of read attempts in a file access property list + * + * \fapl_id{plist_id} + * \param[in] attempts The number of read attempts. Must be a value greater than \Code{0} + * + * \return \herr_t + * + * \return Failure Modes: + * - When the user sets the number of read attempts to \Code{0}. + * - When the input property list is not a file access property list. + * - When the library is unable to set the number of read attempts in the file access property list. + * + * \details H5Pset_metadata_read_attempts() sets the number of reads that the + * library will try when reading checksummed metadata in an HDF5 file opened + * with SWMR access. When reading such metadata, the library will compare the + * checksum computed for the metadata just read with the checksum stored within + * the piece of checksum. When performing SWMR operations on a file, the + * checksum check might fail when the library reads data on a system that is not + * atomic. To remedy such situations, the library will repeatedly read the piece + * of metadata until the check passes or finally fails the read when the allowed + * number of attempts is reached. + * + * The number of read attempts used by the library will depend on how the file is + * opened and whether the user sets the number of read attempts via this routine: + + * - For a file opened with SWMR access: + * - If the user sets the number of attempts to \Code{N}, the library will use \Code{N}. + * - If the user does not set the number of attempts, the library will use the + * default for SWMR access (\Code{100}). + * - For a file opened with non-SWMR access, the library will always use the default + * for non-SWMR access (\Code{1}). The value set via this routine does not have any effect + * during non-SWMR access. + * + * \b Example: The first example illustrates the case in setting the number of read attempts for a file + * opened with SWMR access. + * + * \snippet H5Pset_metadata_read_attempts.c SWMR Access + * + * \b Example: The second example illustrates the case in setting the number of + * read attempts for a file opened with non-SWMR access. The value + * set in the file access property list does not have any effect. + * + * \snippet H5Pset_metadata_read_attempts.c non-SWMR Access + * + * \note \b Motivation: On a system that is not atomic, the library might + * possibly read inconsistent metadata with checksum when performing + * single-writer/multiple-reader (SWMR) operations for an HDF5 file. Upon + * encountering such situations, the library will try reading the metadata + * again to obtain consistent data. This routine provides the means to set + * the number of read attempts other than the library default. + * + * \since 1.10.0 + */ +H5_DLL herr_t H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts); +/** + * \ingroup FAPL + * + * \brief Specifies type of data to be accessed via the \Code{MULTI} driver, + * enabling more direct access + * + * \fapl_id{fapl_id} + * \param[in] type Type of data to be accessed + * + * \return \herr_t + * + * \details H5Pset_multi_type() sets the \Emph{type of data} property in the file + * access property list \p fapl_id. This setting enables a user + * application to specify the type of data the application wishes to + * access so that the application can retrieve a file handle for + * low-level access to the particular member of a set of \Code{MULTI} + * files in which that type of data is stored. The file handle is + * retrieved with a separate call to H5Fget_vfd_handle() (or, in special + * circumstances, to H5FDget_vfd_handle(); see \ref VFL. + * + * The type of data specified in \p type may be one of the following: + * + * <table> + * <tr> + * <td>#H5FD_MEM_SUPER</td> <td>Super block data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_BTREE</td> <td>B-tree data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_DRAW</td> <td>Dataset raw data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_GHEAP</td> <td>Global heap data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_LHEAP</td> <td>Local Heap data</td> + * </tr> + * <tr> + * <td>#H5FD_MEM_OHDR</td> <td>Object header data</td> + * </tr> + * </table> + * + * This function is for use only when accessing an HDF5 file written as a set of + * files with the \Code{MULTI} file driver. + * + * \since 1.6.0 + */ +H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); +/** + * \ingroup FAPL + * + * \brief Sets a callback function to invoke when an object flush occurs in the file + * + * \fapl_id{plist_id} + * \op{func} + * \op_data_in{udata} + * + * \return \herr_t + * + * \details H5Pset_object_flush_cb() sets the callback function to invoke in the + * file access property list \p plist_id whenever an object flush occurs in + * the file. Library objects are group, dataset, and committed + * datatype. + * + * The callback function \p func must conform to the prototype defined below: + * \code + * typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *user_data) + * \endcode + * + * The parameters of the callback function, per the above prototypes, are defined as follows: + * - \Code{object_id} is the identifier of the object which has just been flushed. + * - \Code{user_data} is the user-defined input data for the callback function. + * + * \b Example: The example below illustrates the usage of this routine to set + * the callback function to invoke when an object flush occurs. + * + * \include H5Pset_object_flush_cb.c + * + * \since 1.10.0 + */ +H5_DLL herr_t H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata); +/** + * \ingroup FAPL + * + * \brief Sets the maximum size of the data sieve buffer + * + * \fapl_id{fapl_id} + * \param[in] size Maximum size, in bytes, of data sieve buffer + * + * \return \herr_t + * + * \details H5Pset_sieve_buf_size() sets \p size, the maximum size in bytes of the + * data sieve buffer, which is used by file drivers that are capable of + * using data sieving. + * + * The data sieve buffer is used when performing I/O on datasets in the + * file. Using a buffer which is large enough to hold several pieces of + * the dataset being read in for hyperslab selections boosts + * performance by quite a bit. + * + * The default value is set to 64KB, indicating that file I/O for raw + * data reads and writes will occur in at least 64KB blocks. Setting + * the value to zero (\Code{0}) with this API function will turn off + * the data sieving, even if the VFL driver attempts to use that + * strategy. + * + * Internally, the library checks the storage sizes of the datasets in + * the file. It picks the smaller one between the size from the file + * access property and the size of the dataset to allocate the sieve + * buffer for the dataset in order to save memory usage. + * + * \version 1.6.0 The \p size parameter has changed from type \Code{hsize_t} to \Code{size_t}. + * + * \since 1.4.0 + */ +H5_DLL herr_t H5Pset_sieve_buf_size(hid_t fapl_id, size_t size); +/** + * \ingroup FAPL + * + * \brief Sets the size of a contiguous block reserved for small data + * + * \fapl_id{fapl_id} + * \param[in] size Maximum size, in bytes, of the small data block. + The default size is \Code{2048}. + * + * \return \herr_t + * + * \details H5Pset_small_data_block_size() reserves blocks of \p size bytes for the + * contiguous storage of the raw data portion of \Emph{small} datasets. The + * HDF5 library then writes the raw data from small datasets to this + * reserved space, thus reducing unnecessary discontinuities within + * blocks of meta data and improving I/O performance. + * + * A small data block is actually allocated the first time a qualifying + * small dataset is written to the file. Space for the raw data portion + * of this small dataset is suballocated within the small data block. + * The raw data from each subsequent small dataset is also written to + * the small data block until it is filled; additional small data + * blocks are allocated as required. + * + * The HDF5 library employs an algorithm that determines whether I/O + * performance is likely to benefit from the use of this mechanism with + * each dataset as storage space is allocated in the file. A larger + * \p size will result in this mechanism being employed with larger + * datasets. + * + * The small data block size is set as an allocation property in the + * file access property list identified by \p fapl_id. + * + * Setting \p size to zero (\Code{0}) disables the small data block mechanism. + * + * \since 1.4.4 + */ +H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size); +/** + * \ingroup FAPL + * + * \brief Set the file VOL connector for a file access property list + * + * \fapl_id{plist_id} + * \param[in] new_vol_id VOL connector identifier + * \param[in] new_vol_info Optional VOL information + * + * \return \herr_t + * + * \details H5Pset_vol() sets the VOL connector \p new_vol_id for a file access + * property list \p plist_id using the (optional) VOL information in + * \p new_vol_info. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); + #ifdef H5_HAVE_PARALLEL +/** + * \ingroup GACPL + * + * \brief Sets metadata I/O mode for read operations to collective or independent (default) + * + * \gacpl_id + * \param[in] is_collective Boolean value indicating whether metadata reads are collective + * (\Code{1}) or independent (\Code{0}). + * Default mode: Independent (\Code{0}) + * + * \return \herr_t + * + * \details H5Pset_all_coll_metadata_ops() sets the metadata I/O mode for read + * operations in the access property list \p plist_id. + * + * When engaging in parallel I/O, all metadata write operations must be + * collective. If \p is_collective is \Code{1}, this property specifies + * that the HDF5 library will perform all metadata read operations + * collectively; if \p is_collective is \Code{0}, such operations may + * be performed independently. + * + * Users must be aware that several HDF5 operations can potentially + * issue metadata reads. These include opening a dataset, datatype, or + * group; reading an attribute; or issuing a \Emph{get info} call such + * as getting information for a group with H5Fget_info(). Collective + * I/O requirements must be kept in mind when issuing such calls in the + * context of parallel I/O. + * + * If this property is collective on a file access property list that + * is used in creating or opening a file, then the HDF5 library will + * assume that all metadata read operations issued on that file + * identifier will be issued collectively from all ranks irrespective + * of the individual setting of a particular operation. If this + * assumption is not adhered to, corruption will be introduced in the + * metadata cache and HDF5’s behavior will be undefined. + * + * Alternatively, a user may wish to avoid setting this property + * globally on the file access property list, and individually set it + * on particular object access property lists (dataset, group, link, + * datatype, attribute access property lists) for certain operations. + * This will indicate that only the operations issued with such an + * access property list will be called collectively and other + * operations may potentially be called independently. There are, + * however, several HDF5 operations that can issue metadata reads but + * have no property list in their function signatures to allow passing + * the collective requirement property. For those operations, the only + * option is to set the global collective requirement property on the + * file access property list; otherwise the metadata reads that can be + * triggered from those operations will be done independently by each + * process. + * + * Functions that do not accommodate an access property list but that + * might issue metadata reads are listed in \ref maybe_metadata_reads. + * + * \attention As noted above, corruption will be introduced into the metadata + * cache and HDF5 library behavior will be undefined when both of the following + * conditions exist: + * - A file is created or opened with a file access property list in which the + * collective metadata I/O property is set to \Code{1}. + * - Any function is called that triggers an independent metadata read while the + * file remains open with that file access property list. + * + * \attention An approach that avoids this corruption risk is described above. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); +/** + * \ingroup GACPL + * + * \brief Retrieves metadata read mode setting + * + * \gacpl_id + * \param[out] is_collective Pointer to a buffer containing the Boolean value indicating whether metadata + * reads are collective (\Code{>0}) or independent (\Code{0}). + * Default mode: Independent (\Code{0}) + * + * \return \herr_t + * + * \details H5Pget_all_coll_metadata_ops() retrieves the collective metadata read setting from the access + * property list \p plist_id into \p is_collective. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); +/** + * \ingroup FAPL + * + * \brief Sets metadata write mode to collective or independent (default) + * + * \fapl_id{plist_id} + * \param[out] is_collective Boolean value indicating whether metadata + * writes are collective (\Code{>0}) or independent (\Code{0}). + * \Emph{Default mode:} Independent (\Code{0}) + * \return \herr_t + * + * \details H5Pset_coll_metadata_write() tells the HDF5 library whether to + * perform metadata writes collectively (1) or independently (0). + * + * If collective access is selected, then on a flush of the metadata + * cache, all processes will divide the metadata cache entries to be + * flushed evenly among themselves and issue a single MPI-IO collective + * write operation. This is the preferred method when the size of the + * metadata created by the application is large. + * + * If independent access is selected, the library uses the default + * method for doing metadata I/O either from process zero or + * independently from each process. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); +/** + * \ingroup FAPL + * + * \brief Retrieves metadata write mode setting + * + * \fapl_id{plist_id} + * \param[out] is_collective Pointer to a boolean value indicating whether + * metadata writes are collective (\Code{>0}) or independent (\Code{0}). + * \Emph{Default mode:} Independent (\Code{0}) + * \return \herr_t + * + * \details H5Pget_coll_metadata_write() retrieves the collective metadata write + * setting from the file access property into \p is_collective. + * + * \sa_metadata_ops + * + * \since 1.10.0 + */ H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); + +/** + * \todo Add missing documentation + */ H5_DLL herr_t H5Pget_mpi_params(hid_t fapl_id, MPI_Comm *comm, MPI_Info *info); + +/** + * \todo Add missing documentation + */ H5_DLL herr_t H5Pset_mpi_params(hid_t fapl_id, MPI_Comm comm, MPI_Info info); #endif /* H5_HAVE_PARALLEL */ +/** + * \ingroup FAPL + * + * \brief Sets the metadata cache image option for a file access property list + * + * \fapl_id{plist_id} + * \param[out] config_ptr Pointer to metadata cache image configuration values + * \return \herr_t + * + * \details H5Pset_mdc_image_config() sets the metadata cache image option with + * configuration values specified by \p config_ptr for the file access + * property list specified in \p plist_id. + * + * #H5AC_cache_image_config_t is defined as follows: + * \snippet H5ACpublic.h H5AC_cache_image_config_t_snip + * \click4more + * + * \par Limitations: While it is an obvious error to request a cache image when + * opening the file read only, it is not in general possible to test for + * this error in the H5Pset_mdc_image_config() call. Rather than fail the + * subsequent file open, the library silently ignores the file image + * request in this case.\n It is also an error to request a cache image on + * a file that does not support superblock extension messages (i.e. a + * superblock version less than 2). As above, it is not always possible to + * detect this error in the H5Pset_mdc_image_config() call, and thus the + * request for a cache image will fail silently in this case as well.\n + * Creation of cache images is currently disabled in parallel -- as above, + * any request for a cache image in this context will fail silently.\n + * Files with cache images may be read in parallel applications, but note + * that the load of the cache image is a collective operation triggered by + * the first operation that accesses metadata after file open (or, if + * persistent free space managers are enabled, on the first allocation or + * deallocation of file space, or read of file space manager status, + * whichever comes first). Thus the parallel process may deadlock if any + * process does not participate in this access.\n + * In long sequences of file closes and opens, infrequently accessed + * metadata can accumulate in the cache image to the point where the cost + * of storing and restoring this metadata exceeds the benefit of retaining + * frequently used metadata in the cache image. When implemented, the + * #H5AC_cache_image_config_t::entry_ageout should address this problem. In + * the interim, not requesting a cache image every n file close/open cycles + * may be an acceptable work around. The choice of \c n will be driven by + * application behavior, but \Code{n = 10} seems a good starting point. + * + * \since 1.10.1 + */ H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); -H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); +/** + * \ingroup FAPL + * + * \brief Sets the maximum size for the page buffer and the minimum percentage + * for metadata and raw data pages + * + * \fapl_id{plist_id} + * \param[in] buf_size Maximum size, in bytes, of the page buffer + * \param[in] min_meta_per Minimum metadata percentage to keep in the page buffer + * before allowing pages containing metadata to be evicted (Default is 0) + * \param[in] min_raw_per Minimum raw data percentage to keep in the page buffer + * before allowing pages containing raw data to be evicted (Default is 0) + * \return \herr_t + * + * \details H5Pset_page_buffer_size() sets buf_size, the maximum size in bytes + * of the page buffer. The default value is zero, meaning that page + * buffering is disabled. When a non-zero page buffer size is set, the + * library will enable page buffering if that size is larger or equal + * than a single page size if a paged file space strategy is enabled + * using the functions H5Pset_file_space_strategy() and + * H5Pset_file_space_page_size(). + * + * The page buffer layer captures all I/O requests before they are + * issued to the VFD and "caches" them in fixed sized pages. Once the + * total number of pages exceeds the page buffer size, the library + * evicts pages from the page buffer by writing them to the VFD. At + * file close, the page buffer is flushed writing all the pages to the + * file. + * + * If a non-zero page buffer size is set, and the file space strategy + * is not set to paged or the page size for the file space strategy is + * larger than the page buffer size, the subsequent call to H5Fcreate() + * or H5Fopen() using the \p plist_id will fail. + * + * The function also allows setting the minimum percentage of pages for + * metadata and raw data to prevent a certain type of data to evict hot + * data of the other type. + * + * \since 1.10.1 + * + */ H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); -H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned *min_meta_per, - unsigned *min_raw_per); /* Dataset creation property list (DCPL) routines */ - +/** + * \ingroup DCPL + * + * \brief Determines whether fill value is defined + * + * \dcpl_id{plist} + * \param[out] status Status of fill value in property list + * + * \return \herr_t + * + * \details H5Pfill_value_defined() determines whether a fill value is + * defined in the dataset creation property list \p plist. Valid + * values returned in status are as follows: + * + * <table> + * <tr> + * <td>#H5D_FILL_VALUE_UNDEFINED</td> + * <td>Fill value is undefined.</td> + * </tr> + * <tr> + * <td>#H5D_FILL_VALUE_DEFAULT</td> + * <td>Fill value is the library default.</td> + * </tr> + * <tr> + * <td>#H5D_FILL_VALUE_USER_DEFINED</td> + * <td>Fill value is defined by the application.</td> + * </tr> + * </table> + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status); +/** + * \ingroup DCPL + * + * \brief Retrieves the timing for storage space allocation + * + * \dcpl_id{plist_id} + * \param[out] alloc_time The timing setting for allocating dataset + * storage space + * + * \return \herr_t + * + * \details H5Pget_alloc_time() retrieves the timing for allocating storage + * space for a dataset's raw data. This property is set in the + * dataset creation property list \p plist_id. The timing setting + * is returned in \p alloc_time as one of the following values: + * + * <table> + * <tr> + * <td>#H5D_ALLOC_TIME_DEFAULT<br /> </td> + * <td>Uses the default allocation time, based on the dataset + * storage method. <br />See the \p alloc_time description in + * H5Pset_alloc_time() for default allocation times for + * various storage methods.</td> + * </tr> + * <tr> + * <td>#H5D_ALLOC_TIME_EARLY</td> + * <td>All space is allocated when the dataset is created.</td> + * </tr> + * <tr> + * <td>#H5D_ALLOC_TIME_INCR</td> + * <td>Space is allocated incrementally as data is written + * to the dataset.</td> + * </tr> + * <tr> + * <td>#H5D_ALLOC_TIME_LATE</td> + * <td>All space is allocated when data is first written to + * the dataset.</td> + * </tr> + * </table> + * + * \note H5Pget_alloc_time() is designed to work in concert with the + * dataset fill value and fill value write time properties, set + * with the functions H5Pget_fill_value() and H5Pget_fill_time(). + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/); /** * \ingroup DCPL * @@ -609,7 +5551,6 @@ H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned */ H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/); /** - *------------------------------------------------------------------------- * * \ingroup DCPL * @@ -636,8 +5577,80 @@ H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/); */ H5_DLL herr_t H5Pget_chunk_opts(hid_t plist_id, unsigned *opts); /** - *------------------------------------------------------------------------- + * \ingroup DCPL + * + * \brief Retrieves the setting for whether or not to create minimized + * dataset object headers + * + * \dcpl_id + * \param[out] minimize Flag indicating whether the library will or will + * not create minimized dataset object headers + * + * \return \herr_t * + * \details H5Pget_dset_no_attrs_hint() retrieves the + * <i>no dataset attributes</i> hint setting for the dataset + * creation property list \p dcpl_id. This setting is used to + * inform the library to create minimized dataset object headers + * when TRUE. The setting value is returned in the boolean pointer + * \p minimize. + * + * \since 1.10.5 + * + */ +H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize); +/** + * \ingroup DCPL + * + * \brief Returns information about an external file + * + * \dcpl_id{plist_id} + * \param[in] idx External file index + * \param[in] name_size Maximum length of \p name array + * \param[out] name Name of the external file + * \param[out] offset Pointer to a location to return an offset value + * \param[out] size Pointer to a location to return the size of the + * external file data + * + * \return \herr_t + * + * \details H5Pget_external() returns information about an external file. + * The external file is specified by its index, \p idx, which + * is a number from zero to N-1, where N is the value returned + * by H5Pget_external_count(). At most \p name_size characters + * are copied into the \p name array. If the external file name + * is longer than \p name_size with the null terminator, the + * return value is not null terminated (similar to strncpy()). + * + * If \p name_size is zero or \p name is the null pointer, the + * external file name is not returned. If \p offset or \p size + * are null pointers then the corresponding information is not + * returned. + * + * \version 1.6.4 \p idx parameter type changed to unsigned. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/, + off_t *offset /*out*/, hsize_t *size /*out*/); +/** + * \ingroup DCPL + * + * \brief Returns the number of external files for a dataset + * + * \dcpl_id{plist_id} + * + * \return Returns the number of external files if successful; otherwise + * returns a negative value. + * + * \details H5Pget_external_count() returns the number of external files + * for the specified dataset. + * + * \since 1.0.0 + * + */ +H5_DLL int H5Pget_external_count(hid_t plist_id); +/** * \ingroup DCPL * * \brief Retrieves the time when fill values are written to a dataset @@ -682,8 +5695,6 @@ H5_DLL herr_t H5Pget_chunk_opts(hid_t plist_id, unsigned *opts); */ H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/); /** - *------------------------------------------------------------------------- - * * \ingroup DCPL * * \brief Retrieves a dataset fill value @@ -721,7 +5732,6 @@ H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out* */ H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/); /** - *------------------------------------------------------------------------- * \ingroup DCPL * * \brief Returns the layout of the raw data for a dataset @@ -757,7 +5767,221 @@ H5_DLL herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out */ H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id); /** - *------------------------------------------------------------------------- + * \ingroup DCPL + * + * \brief Gets the number of mappings for the virtual dataset + * + * \dcpl_id + * \param[out] count The number of mappings + * + * \return \herr_t + * + * \details H5Pget_virtual_count() gets the number of mappings for a + * virtual dataset that has the creation property list specified + * by \p dcpl_id. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/); +/** + * \ingroup DCPL + * + * \brief Gets the name of a source dataset used in the mapping + * + * \dcpl_id + * \param[in] index Mapping index. The value of \p index is 0 (zero) or + * greater and less than \p count + * (0 ≤ \p index < \p count), where \p count is the + * number of mappings returned by H5Pget_virtual_count(). + * \param[out] name A buffer containing the name of the source dataset + * \param[in] size The size, in bytes, of the name buffer. Must be the + * size of the dataset name in bytes plus 1 for a NULL + * terminator + * + * \return Returns the length of the dataset name if successful; + * otherwise returns a negative value. + * + * \details H5Pget_virtual_dsetname() takes the dataset creation property + * list for the virtual dataset, \p dcpl_id, the mapping index, + * \p index, the size of the dataset name for a source dataset, + * \p size, and retrieves the name of the source dataset used in + * the mapping. + * + * Up to \p size characters of the dataset name are returned in + * \p name; additional characters, if any, are not returned to + * the user application. + * + * If the length of the dataset name, which determines the + * required value of \p size, is unknown, a preliminary call + * to H5Pget_virtual_dsetname() with the last two parameters + * set to NULL and zero respectively can be made. The return + * value of this call will be the size in bytes of the dataset + * name. That value, plus 1 for a NULL terminator, must then be + * assigned to \p size for a second H5Pget_virtual_dsetname() + * call, which will retrieve the actual dataset name. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size); +/** + * \ingroup DCPL + * + * \brief Gets the filename of a source dataset used in the mapping + * + * \dcpl_id + * \param[in] index Mapping index. The value of \p index is 0 (zero) or + * greater and less than \p count + * (0 ≤ \p index < \p count), where \p count is the + * number of mappings returned by H5Pget_virtual_count(). + * \param[out] name A buffer containing the name of the file containing + * the source dataset + * \param[in] size The size, in bytes, of the name buffer. Must be the + * size of the filename in bytes plus 1 for a NULL + * terminator + * + * \return Returns the length of the filename if successful; otherwise + * returns a negative value. + * + * \details H5Pget_virtual_filename() takes the dataset creation property + * list for the virtual dataset, \p dcpl_id, the mapping index, + * \p index, the size of the filename for a source dataset, + * \p size, and retrieves the name of the file for a source dataset + * used in the mapping. + * + * Up to \p size characters of the filename are returned in + * \p name; additional characters, if any, are not returned to + * the user application. + * + * If the length of the filename, which determines the required + * value of \p size, is unknown, a preliminary call to + * H5Pget_virtual_filename() with the last two parameters set + * to NULL and zero respectively can be made. The return value + * of this call will be the size in bytes of the filename. That + * value, plus 1 for a NULL terminator, must then be assigned to + * \p size for a second H5Pget_virtual_filename() call, which + * will retrieve the actual filename. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL ssize_t H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size); +/** + * \ingroup DCPL + * + * \brief Gets a dataspace identifier for the selection within the source + * dataset used in the mapping + * + * \dcpl_id + * \param[in] index Mapping index. The value of \p index is 0 (zero) or + * greater and less than \p count + * (0 ≤ \p index < \p count), where \p count is the number + * of mappings returned by H5Pget_virtual_count(). + * + * \return \hid_t{valid dataspace identifier} + * + * \details H5Pget_virtual_srcspace() takes the dataset creation property + * list for the virtual dataset, \p dcpl_id, and the mapping + * index, \p index, and returns a dataspace identifier for the + * selection within the source dataset used in the mapping. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL hid_t H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index); +/** + * \ingroup DCPL + * + * \brief Gets a dataspace identifier for the selection within the virtual + * dataset used in the mapping + * + * \dcpl_id + * \param[in] index Mapping index. The value of \p index is 0 (zero) or + * greater and less than \p count + * (0 ≤ \p index < \p count), where \p count is the number + * of mappings returned by H5Pget_virtual_count() + * + * \return \hid_t{valid dataspace identifier} + * + * \details H5Pget_virtual_vspace() takes the dataset creation property + * list for the virtual dataset, \p dcpl_id, and the mapping + * index, \p index, and returns a dataspace identifier for the + * selection within the virtual dataset used in the mapping. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL hid_t H5Pget_virtual_vspace(hid_t dcpl_id, size_t index); +/** + * \ingroup DCPL + * + * \brief Sets the timing for storage space allocation + * + * \dcpl_id{plist_id} + * \param[in] alloc_time When to allocate dataset storage space + * + * \return \herr_t + * + * \details H5Pset_alloc_time() sets up the timing for the allocation of + * storage space for a dataset's raw data. This property is set + * in the dataset creation property list \p plist_id. Timing is + * specified in \p alloc_time with one of the following values: + * + * <table> + * <tr> + * <td>#H5D_ALLOC_TIME_DEFAULT</td> + * <td>Allocate dataset storage space at the default time<br /> + * (Defaults differ by storage method.)</td> + * </tr> + * <tr> + * <td>#H5D_ALLOC_TIME_EARLY</td> + * <td>Allocate all space when the dataset is created<br /> + * (Default for compact datasets.)</td> + * </tr> + * <tr> + * <td>#H5D_ALLOC_TIME_INCR</td> + * <td>Allocate space incrementally, as data is written to + * the dataset<br />(Default for chunked storage datasets.) + * + * \li Chunked datasets: Storage space allocation for each + * chunk is deferred until data is written to the chunk. + * \li Contiguous datasets: Incremental storage space + * allocation for contiguous data is treated as late + * allocation. + * \li Compact datasets: Incremental allocation is not + * allowed with compact datasets; H5Pset_alloc_time() + * will return an error.</td> + * </tr> + * <tr> + * <td>#H5D_ALLOC_TIME_LATE</td> + * <td>Allocate all space when data is first written to the + * dataset<br /> + * (Default for contiguous datasets.)</td> + * </tr> + * </table> + * + * \note H5Pset_alloc_time() is designed to work in concert with the + * dataset fill value and fill value write time properties, set + * with the functions H5Pset_fill_value() and H5Pset_fill_time(). + * + * \note See H5Dcreate() for further cross-references. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time); +/** * \ingroup DCPL * * \brief Sets the size of the chunks used to store a chunked layout @@ -801,8 +6025,6 @@ H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id); */ H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]); /** - *------------------------------------------------------------------------- - * * \ingroup DCPL * * \brief Sets the edge chunk option in a dataset creation property list @@ -831,7 +6053,7 @@ H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims* * dataspace are affected by this option. Such chunks are * referred to as partial edge chunks. * - * \note \b Motivation: H5Pset_chunk_opts() is used to specify storage + * \b Motivation: H5Pset_chunk_opts() is used to specify storage * options for chunks on the edge of a dataset’s dataspace. This * capability allows the user to tune performance in cases where * the dataset size may not be a multiple of the chunk size and @@ -842,8 +6064,79 @@ H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims* */ H5_DLL herr_t H5Pset_chunk_opts(hid_t plist_id, unsigned opts); /** - *------------------------------------------------------------------------- + * \ingroup DCPL + * + * \brief Sets the flag to create minimized dataset object headers + * + * \dcpl_id + * \param[in] minimize Flag for indicating whether or not a dataset's + * object header will be minimized + * + * \return \herr_t + * + * \details H5Pset_dset_no_attrs_hint() sets the no dataset attributes + * hint setting for the dataset creation property list \p dcpl_id. + * Datasets created with the dataset creation property list + * \p dcpl_id will have their object headers minimized if the + * boolean flag \p minimize is set to TRUE. By setting \p minimize + * to TRUE, the library expects that no attributes will be added + * to the dataset. Attributes can be added, but they are appended + * with a continuation message, which can reduce performance. * + * This setting interacts with H5Fset_dset_no_attrs_hint(): if + * either is set to TRUE, then the created dataset's object header + * will be minimized. + * + * \since 1.10.5 + * + */ +H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize); +/** + * \ingroup DCPL + * + * \brief Adds an external file to the list of external files + * + * \dcpl_id{plist_id} + * \param[in] name Name of an external file + * \param[in] offset Offset, in bytes, from the beginning of the file to + * the location in the file where the data starts + * \param[in] size Number of bytes reserved in the file for the data + * + * \return \herr_t + * + * \details The first call to H5Pset_external() sets the external + * storage property in the property list, thus designating that + * the dataset will be stored in one or more non-HDF5 file(s) + * external to the HDF5 file. This call also adds the file + * \p name as the first file in the list of external files. + * Subsequent calls to the function add the named file as the + * next file in the list. + * + * If a dataset is split across multiple files, then the files + * should be defined in order. The total size of the dataset is + * the sum of the \p size arguments for all the external files. + * If the total size is larger than the size of a dataset then + * the dataset can be extended (provided the data space also + * allows the extending). + * + * The \p size argument specifies the number of bytes reserved + * for data in the external file. If \p size is set to + * #H5F_UNLIMITED, the external file can be of unlimited size + * and no more files can be added to the external files list. + * If \p size is set to 0 (zero), no external file will actually + * be created. + * + * All of the external files for a given dataset must be specified + * with H5Pset_external() before H5Dcreate() is called to create + * the dataset. If one these files does not exist on the system + * when H5Dwrite() is called to write data to it, the library + * will create the file. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size); +/** * \ingroup DCPL * * \brief Sets the time when fill values are written to a dataset @@ -886,8 +6179,6 @@ H5_DLL herr_t H5Pset_chunk_opts(hid_t plist_id, unsigned opts); */ H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time); /** - *------------------------------------------------------------------------- - * * \ingroup DCPL * * \brief Sets the fill value for a dataset @@ -938,8 +6229,6 @@ H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time); */ H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value); /** - *------------------------------------------------------------------------- - * * \ingroup DCPL * * \brief Sets up use of the shuffle filter @@ -974,7 +6263,6 @@ H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value */ H5_DLL herr_t H5Pset_shuffle(hid_t plist_id); /** - *------------------------------------------------------------------------- * \ingroup DCPL * * \brief Sets the type of storage used to store the raw data for a dataset @@ -1012,7 +6300,203 @@ H5_DLL herr_t H5Pset_shuffle(hid_t plist_id); */ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout); /** - *------------------------------------------------------------------------- + * \ingroup DCPL + * + * \brief Sets up the use of the N-Bit filter + * + * \dcpl_id{plist_id} + * + * \return \herr_t + * + * \details H5Pset_nbit() sets the N-Bit filter, #H5Z_FILTER_NBIT, in the + * dataset creation property list \p plist_id. + * + * The HDF5 user can create an N-Bit datatype with the following + * code: + * <pre> + * hid_t nbit_datatype = H5Tcopy(H5T_STD_I32LE); + * H5Tset_precision(nbit_datatype, 16); + * H5Tset_offset(nbit_datatype, 4); + * </pre> + * + * In memory, one value of the N-Bit datatype in the above example + * will be stored on a little-endian machine as follows: + * + * <table> + * <tr> + * <td>byte 3</td> + * <td>byte 2</td> + * <td>byte 1</td> + * <td>byte 0</td> + * </tr> + * <tr> + * <td>????????</td> + * <td>????SPPP</td> + * <td>PPPPPPPP</td> + * <td>PPPP????</td> + * </tr> + * </table> + * Note: S - sign bit, P - significant bit, ? - padding bit; For + * signed integer, the sign bit is included in the precision. + * + * When data of the above datatype is stored on disk using the + * N-bit filter, all padding bits are chopped off and only + * significant bits are stored. The values on disk will be + * something like: + * + * <table> + * <tr> + * <td>1st value</td> + * <td>2nd value</td> + * <td>...</td> + * </tr> + * <tr> + * <td>SPPPPPPPPPPPPPPP</td> + * <td>SPPPPPPPPPPPPPPP</td> + * <td>...</td> + * </tr> + * </table> + * The N-Bit filter is used effectively for compressing data of + * an N-Bit datatype as well as a compound and an array + * datatype with N-Bit fields. However, the datatype classes of + * the N-Bit datatype or the N-Bit field of the compound + * datatype or the array datatype are limited to integer or + * floating-point. + * + * The N-Bit filter supports complex situations where a compound + * datatype contains member(s) of a compound datatype or an array + * datatype that has a compound datatype as the base type. + * However, it does not support the situation where an array + * datatype has a variable-length or variable-length string as + * its base datatype. The filter does support the situation where + * a variable-length or variable-length string is a member of a + * compound datatype. + * + * The N-Bit filter allows all other HDF5 datatypes (such as + * time, string, bitfield, opaque, reference, enum, and variable + * length) to pass through as a no-op. + * + * Like other I/O filters supported by the HDF5 library, + * application using the N-Bit filter must store data with + * chunked storage. + * + * By nature, the N-Bit filter should not be used together with + * other I/O filters. + * + * \version 1.8.8 Fortran subroutine introduced in this release. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_nbit(hid_t plist_id); +/** + * \ingroup DCPL + * + * \brief Sets up the use of the scale-offset filter + * + * \dcpl_id{plist_id} + * \param[in] scale_type Flag indicating compression method + * \param[in] scale_factor Parameter related to scale. Must be + * non-negative + * + * \return \herr_t + * + * \details H5Pset_scaleoffset() sets the scale-offset filter, + * #H5Z_FILTER_SCALEOFFSET, for a dataset. + * + * Generally speaking, scale-offset compression performs a scale and/or + * offset operation on each data value and truncates the resulting + * value to a minimum number of bits (MinBits) before storing it. The + * current scale-offset filter supports integer and floating-point + * datatypes. + * + * For an integer datatype, the parameter \p scale_type should be set + * to #H5Z_SO_INT (2). The parameter \p scale_factor denotes MinBits. + * If the user sets it to H5Z_SO_INT_MINBITS_DEFAULT (0), the filter + * will calculate MinBits. If \p scale_factor is set to a positive + * integer, the filter does not do any calculation and just uses the + * number as MinBits. However, if the user gives a MinBits that is less + * than what would be generated by the filter, the compression will be + * lossy. Also, the MinBits supplied by the user cannot exceed the + * number of bits to store one value of the dataset datatype. + * + * For a floating-point datatype, the filter adopts the GRiB data + * packing mechanism, which offers two alternate methods: E-scaling and + * D-scaling. Both methods are lossy compression. If the parameter + * \p scale_type is set to #H5Z_SO_FLOAT_DSCALE (0), the filter will + * use the D-scaling method; if it is set to #H5Z_SO_FLOAT_ESCALE (1), + * the filter will use the E-scaling method. Since only the D-scaling + * method is implemented, \p scale_type should be set to + * #H5Z_SO_FLOAT_DSCALE or 0. + * + * When the D-scaling method is used, the original data is "D" scaled + * — multiplied by 10 to the power of \p scale_factor, and the + * "significant" part of the value is moved to the left of the decimal + * point. Care should be taken in setting the decimal \p scale_factor + * so that the integer part will have enough precision to contain the + * appropriate information of the data value. For example, if + * \p scale_factor is set to 2, the number 104.561 will be 10456.1 + * after "D" scaling. The last digit 1 is not "significant" and is + * thrown off in the process of rounding. The user should make sure that + * after "D" scaling and rounding, the data values are within the range + * that can be represented by the integer (same size as the + * floating-point type). + * + * Valid values for scale_type are as follows: + * + * <table> + * <tr> + * <td>#H5Z_SO_FLOAT_DSCALE (0)</td> + * <td>Floating-point type, using variable MinBits method</td> + * </tr> + * <tr> + * <td>#H5Z_SO_FLOAT_ESCALE (1)</td> + * <td>Floating-point type, using fixed MinBits method</td> + * </tr> + * <tr> + * <td>#H5Z_SO_INT (2)</td> + * <td>Integer type</td> + * </tr> + * </table> + * + * The meaning of \p scale_factor varies according to the value + * assigned to \p scale_type: + * + * <table> + * <tr> + * <th>\p scale_type value</th> + * <th>\p scale_factor description</th> + * </tr> + * <tr> + * <td>#H5Z_SO_FLOAT_DSCALE</td> + * <td>Denotes the decimal scale factor for D-scaling and can be + * positive, negative or zero. This is the current + * implementation of the library.</td> + * </tr> + * <tr> + * <td>#H5Z_SO_FLOAT_ESCALE</td> + * <td>Denotes MinBits for E-scaling and must be a positive integer. + * This is not currently implemented by the library.</td> + * </tr> + * <tr> + * <td>#H5Z_SO_INT</td> + * <td>Denotes MinBits and it should be a positive integer or + * #H5Z_SO_INT_MINBITS_DEFAULT (0). If it is less than 0, the + * library will reset it to 0 since it is not implemented. + * </td> + * </tr> + * </table> + * Like other I/O filters supported by the HDF5 library, an + * application using the scale-offset filter must store data with + * chunked storage. + * + * \version 1.8.8 Fortran90 subroutine introduced in this release. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_factor); +/** * \ingroup DCPL * * \brief Sets up use of the SZIP compression filter @@ -1165,120 +6649,2609 @@ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout); * * \since 1.6.0 * - *-------------------------------------------------------------------------- */ -H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block); -H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, - const char *src_dset_name, hid_t src_space_id); -H5_DLL herr_t H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/); -H5_DLL hid_t H5Pget_virtual_vspace(hid_t dcpl_id, size_t index); -H5_DLL hid_t H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index); -H5_DLL ssize_t H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size); -H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name /*out*/, size_t size); -H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size); -H5_DLL int H5Pget_external_count(hid_t plist_id); -H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out*/, - off_t *offset /*out*/, hsize_t *size /*out*/); -H5_DLL herr_t H5Pset_nbit(hid_t plist_id); -H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_factor); -H5_DLL herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status); -H5_DLL herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time); -H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/); -H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize); -H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize); +H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block); + +/** + * \ingroup DCPL + * + * \brief Sets the mapping between virtual and source datasets + * + * \dcpl_id + * \param[in] vspace_id The dataspace identifier with the selection within the + * virtual dataset applied, possibly an unlimited selection + * \param[in] src_file_name The name of the HDF5 file where the source dataset is + * located or a \Code{"."} (period) for a source dataset in the same + * file. The file might not exist yet. The name can be specified using + * a C-style \c printf statement as described below. + * \param[in] src_dset_name The path to the HDF5 dataset in the file specified by + * \p src_file_name. The dataset might not exist yet. The dataset name + * can be specified using a C-style \c printf statement as described below. + * \param[in] src_space_id The source dataset’s dataspace identifier with a + * selection applied, possibly an unlimited selection + * \return \herr_t + * + * \details H5Pset_virtual() maps elements of the virtual dataset (VDS) + * described by the virtual dataspace identifier \p vspace_id to the + * elements of the source dataset described by the source dataset + * dataspace identifier \p src_space_id. The source dataset is + * identified by the name of the file where it is located, + * \p src_file_name, and the name of the dataset, \p src_dset_name. + * + * \par C-style \c printf Formatting Statements: + * C-style \c printf formatting allows a pattern to be specified in the name + * of a source file or dataset. Strings for the file and dataset names are + * treated as literals except for the following substitutions: + * <table> + * <tr> + * <td>\Code{"%%"}</td> + * <td>Replaced with a single \Code{"%"} (percent) character.</td> + * </tr> + * <tr> + * <td><code>"%<d>b"</code></td> + * <td>Where <code>"<d>"</code> is the virtual dataset dimension axis (0-based) + * and \Code{"b"} indicates that the block count of the selection in that + * dimension should be used. The full expression (for example, \Code{"%0b"}) + * is replaced with a single numeric value when the mapping is evaluated at + * VDS access time. Example code for many source and virtual dataset mappings + * is available in the "Examples of Source to Virtual Dataset Mapping" + * chapter in the + * <a href="https://portal.hdfgroup.org/display/HDF5/RFC+HDF5+Virtual+Dataset"> + * RFC: HDF5 Virtual Dataset</a>. + * </td> + * </tr> + * </table> + * If the printf form is used for the source file or dataset names, the + * selection in the source dataset’s dataspace must be fixed-size. + * + * \par Source File Resolutions: + * When a source dataset residing in a different file is accessed, the + * library will search for the source file \p src_file_name as described + * below: + * \li If \p src_file_name is a \Code{"."} (period) then it refers to the + * file containing the virtual dataset. + * \li If \p src_file_name is a relative pathname, the following steps are + * performed: + * - The library will get the prefix(es) set in the environment + * variable \c HDF5_VDS_PREFIX and will try to prepend each prefix + * to \p src_file_name to form a new \p src_file_name. If the new + * \p src_file_name does not exist or if \c HDF5_VDS_PREFIX is not + * set, the library will get the prefix set via H5Pset_virtual_prefix() + * and prepend it to \p src_file_name to form a new \p src_file_name. + * If the new \p src_file_name does not exist or no prefix is being + * set by H5Pset_virtual_prefix() then the path of the file containing + * the virtual dataset is obtained. This path can be the absolute path + * or the current working directory plus the relative path of that + * file when it is created/opened. The library will prepend this path + * to \p src_file_name to form a new \p src_file_name. + * - If the new \p src_file_name does not exist, then the library will + * look for \p src_file_name and will return failure/success accordingly. + * \li If \p src_file_name is an absolute pathname, the library will first + * try to find \p src_file_name. If \p src_file_name does not exist, + * \p src_file_name is stripped of directory paths to form a new + * \p src_file_name. The search for the new \p src_file_name then follows + * the same steps as described above for a relative pathname. See + * examples below illustrating how \p src_file_name is stripped to form + * a new \p src_file_name. + * \par + * Note that \p src_file_name is considered to be an absolute pathname when + * the following condition is true: + * \li For Unix, the first character of \p src_file_name is a slash + * (\Code{/}).\n For example, consider a \p src_file_name of + * \Code{/tmp/A.h5}. If that source file does not exist, the new + * \p src_file_name after stripping will be \Code{A.h5}. + * \li For Windows, there are 6 cases: + * 1. \p src_file_name is an absolute drive with absolute pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5}. + * 2. \p src_file_name is an absolute pathname without specifying + * drive name.\n For example, consider a \p src_file_name of + * \Code{/tmp/A.h5}. If that source file does not exist, the new + * \p src_file_name after stripping will be \Code{A.h5}. + * 3. \p src_file_name is an absolute drive with relative pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{tmp/A.h5}. + * 4. \p src_file_name is in UNC (Uniform Naming Convention) format + * with server name, share name, and pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5}. + * 5. \p src_file_name is in Long UNC (Uniform Naming Convention) + * format with server name, share name, and pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5}. + * 6. \p src_file_name is in Long UNC (Uniform Naming Convention) + * format with an absolute drive and an absolute pathname.\n + * For example, consider a \p src_file_name of \Code{/tmp/A.h5}. + * If that source file does not exist, the new \p src_file_name + * after stripping will be \Code{A.h5} + * + * \see <a href="https://portal.hdfgroup.org/display/HDF5/Virtual+Dataset++-+VDS"> + * Virtual Dataset Overview</a> + * + * \see_virtual + * + * \version 1.10.2 A change was made to the method of searching for VDS source files. + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, + const char *src_dset_name, hid_t src_space_id); /* Dataset access property list (DAPL) routines */ -H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0); -H5_DLL herr_t H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, - double *rdcc_w0 /*out*/); -H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); -H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); -H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); -H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); -H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix); -H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char *prefix /*out*/, size_t size); -H5_DLL herr_t H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t boundary[], - H5D_append_cb_t func, void *udata); -H5_DLL herr_t H5Pget_append_flush(hid_t plist_id, unsigned dims, hsize_t boundary[], H5D_append_cb_t *func, - void **udata); -H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char *prefix); +/** + * \ingroup DAPL + * + * \brief Retrieves the values of the append property that is set up in + * the dataset access property list + * + * \dapl_id + * \param[in] dims The number of elements for \p boundary + * \param[in] boundary The dimension sizes used to determine the boundary + * \param[in] func The user-defined callback function + * \param[in] udata The user-defined input data + * + * \return \herr_t + * + * \details H5Pget_append_flush() obtains the following information + * from the dataset access property list, \p dapl_id. + * + * \p boundary consists of the sizes set up in the access + * property list that are used to determine when a dataset + * dimension size hits the boundary. Only at most \p dims + * boundary sizes are retrieved, and \p dims will not exceed + * the corresponding value that is set in the property list. + * + * \p func is the user-defined callback function to invoke when + * a dataset’s appended dimension size reaches a boundary and + * \p udata is the user-defined input data for the callback + * function. + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pget_append_flush(hid_t dapl_id, unsigned dims, hsize_t boundary[], H5D_append_cb_t *func, + void **udata); +/** + * \ingroup DAPL + * + * \brief Retrieves the raw data chunk cache parameters + * + * \dapl_id + * \param[out] rdcc_nslots Number of chunk slots in the raw data chunk + * cache hash table + * \param[out] rdcc_nbytes Total size of the raw data chunk cache, in + * bytes + * \param[out] rdcc_w0 Preemption policy + * + * \return \herr_t + * + * \details H5Pget_chunk_cache() retrieves the number of chunk slots in + * the raw data chunk cache hash table, the maximum possible + * number of bytes in the raw data chunk cache, and the + * preemption policy value. + * + * These values are retrieved from a dataset access property + * list. If the values have not been set on the property list, + * then values returned will be the corresponding values from + * a default file access property list. + * + * Any (or all) pointer arguments may be null pointers, in which + * case the corresponding data is not returned. + * + * \since 1.8.3 + * + */ +H5_DLL herr_t H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, size_t *rdcc_nbytes /*out*/, + double *rdcc_w0 /*out*/); +/** + * \ingroup DAPL + * + * \brief Retrieves the prefix for external raw data storage files as set + * in the dataset access property list + * + * \dapl_id + * \param[in,out] prefix Dataset external storage prefix in UTF-8 or + * ASCII (\em Path and \em filename must be ASCII + * on Windows systems.) + * \param[in] size Size of prefix buffer in bytes + * + * \return Returns the size of \p prefix and the prefix string will be + * stored in \p prefix if successful. + * Otherwise returns a negative value and the contents of \p prefix + * will be undefined. + * + * \details H5Pget_efile_prefix() retrieves the file system path prefix + * for locating external files associated with a dataset that + * uses external storage. This will be the value set with + * H5Pset_efile_prefix() or the HDF5 library’s default. + * + * The value of \p size is the size in bytes of the prefix, + * including the NULL terminator. If the size is unknown, a + * preliminary H5Pget_elink_prefix() call with the pointer + * \p prefix set to NULL will return the size of the prefix + * without the NULL terminator. + * + * The \p prefix buffer must be allocated by the caller. In a + * call that retrieves the actual prefix, that buffer must be + * of the size specified in \p size. + * + * \note See H5Pset_efile_prefix() for a more complete description of + * file location behavior and for notes on the use of the + * HDF5_EXTFILE_PREFIX environment variable. + * + * \since 1.10.0, 1.8.17 + * + */ H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char *prefix /*out*/, size_t size); +/** + * \ingroup DAPL + * + * \brief Retrieves prefix applied to VDS source file paths + * + * \dapl_id + * \param[out] prefix Prefix applied to VDS source file paths + * \param[in] size Size of prefix, including null terminator + * + * \return If successful, returns a non-negative value specifying the size + * in bytes of the prefix without the NULL terminator; otherwise + * returns a negative value. + * + * \details H5Pget_virtual_prefix() retrieves the prefix applied to the + * path of any VDS source files traversed. + * + * When an VDS source file is traversed, the prefix is retrieved + * from the dataset access property list \p dapl_id, returned + * in the user-allocated buffer pointed to by \p prefix, and + * prepended to the filename stored in the VDS virtual file, set + * with H5Pset_virtual(). + * + * The size in bytes of the prefix, including the NULL terminator, + * is specified in \p size. If \p size is unknown, a preliminary + * H5Pget_virtual_prefix() call with the pointer \p prefix set to + * NULL will return the size of the prefix without the NULL + * terminator. + * + * \see_virtual + * + * \since 1.10.2 + * + */ +H5_DLL ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char *prefix /*out*/, size_t size); +/** + * \ingroup DAPL + * + * \brief Returns the maximum number of missing source files and/or datasets + * with the printf-style names when getting the extent for an unlimited + * virtual dataset + * + * \dapl_id + * \param[out] gap_size Maximum number of the files and/or datasets + * allowed to be missing for determining the extent + * of an unlimited virtual dataset with printf-style + * mappings. (\em Default: 0) + * + * \return \herr_t + * + * \details H5Pget_virtual_printf_gap() returns the maximum number of + * missing printf-style files and/or datasets for determining the + * extent of an unlimited virtual dataaset, \p gap_size, using + * the access property list for the virtual dataset, \p dapl_id. + * + * The default library value for \p gap_size is 0 (zero). + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t dapl_id, hsize_t *gap_size); +/** + * \ingroup DAPL + * + * \brief Retrieves the view of a virtual dataset accessed with + * \p dapl_id + * + * \dapl_id + * \param[out] view The flag specifying the view of the virtual dataset. + * Valid values are: + * \li #H5D_VDS_FIRST_MISSING + * \li #H5D_VDS_LAST_AVAILABLE + * + * \return \herr_t + * + * \details H5Pget_virtual_view() takes the virtual dataset access property + * list, \p dapl_id, and retrieves the flag, \p view, set by the + * H5Pset_virtual_view() call. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); +/** + * \ingroup DAPL + * + * \brief Sets two actions to perform when the size of a dataset’s + * dimension being appended reaches a specified boundary + * + * \dapl_id + * \param[in] ndims The number of elements for boundary + * \param[in] boundary The dimension sizes used to determine the boundary + * \param[in] func The user-defined callback function + * \param[in] udata The user-defined input data + * + * \return \herr_t + * + * \details H5Pset_append_flush() sets the following two actions to + * perform for a dataset associated with the dataset access + * property list \p dapl_id: + * + * \li Call the callback function \p func set in the property + * list + * \li Flush the dataset associated with the dataset access + * property list + * + * When a user is appending data to a dataset via H5DOappend() + * and the dataset’s newly extended dimension size hits a + * specified boundary, the library will perform the first action + * listed above. Upon return from the callback function, the + * library will then perform the second action listed above and + * return to the user. If no boundary is hit or set, the two + * actions above are not invoked. + * + * The specified boundary is indicated by the parameter + * \p boundary. It is a 1-dimensional array with \p ndims + * elements, which should be the same as the rank of the + * dataset’s dataspace. While appending to a dataset along a + * particular dimension index via H5Dappend(), the library + * determines a boundary is reached when the resulting dimension + * size is divisible by \p boundary[index]. A zero value for + * \p boundary[index] indicates no boundary is set for that + * dimension index. + * + * The setting of this property will apply only for a chunked + * dataset with an extendible dataspace. A dataspace is extendible + * when it is defined with either one of the following: + * + * \li A dataspace with fixed current and maximum dimension sizes + * \li A dataspace with at least one unlimited dimension for its + * maximum dimension size + * + * When creating or opening a chunked dataset, the library will + * check whether the boundary as specified in the access property + * list is set up properly. The library will fail the dataset + * create or open if the following conditions are true: + * + * \li \p ndims, the number of elements for boundary, is not the + * same as the rank of the dataset’s dataspace. + * \li A non-zero boundary value is specified for a non-extendible + * dimension. + * + * The callback function \p func must conform to the following + * prototype: + * \snippet H5Dpublic.h H5D_append_cb_t_snip + * + * The parameters of the callback function, per the above + * prototype, are defined as follows: + * + * \li \p dataset_id is the dataset identifier. + * \li \p cur_dims is the dataset’s current dimension sizes when + * a boundary is hit. + * \li \p user_data is the user-defined input data. + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_append_flush(hid_t dapl_id, unsigned ndims, const hsize_t boundary[], + H5D_append_cb_t func, void *udata); +/** + * \ingroup DAPL + * + * \brief Sets the raw data chunk cache parameters + * + * \dapl_id + * \param[in] rdcc_nslots The number of chunk slots in the raw data chunk + * cache for this dataset. Increasing this value + * reduces the number of cache collisions, but + * slightly increases the memory used. Due to the + * hashing strategy, this value should ideally be a + * prime number. As a rule of thumb, this value + * should be at least 10 times the number of chunks + * that can fit in \p rdcc_nbytes bytes. For maximum + * performance, this value should be set + * approximately 100 times that number of chunks. + * The default value is 521. If the value passed is + * #H5D_CHUNK_CACHE_NSLOTS_DEFAULT, then the + * property will not be set on \p dapl_id and the + * parameter will come from the file access + * property list used to open the file. + * \param[in] rdcc_nbytes The total size of the raw data chunk cache for + * this dataset. In most cases increasing this + * number will improve performance, as long as + * you have enough free memory. + * The default size is 1 MB. If the value passed is + * #H5D_CHUNK_CACHE_NBYTES_DEFAULT, then the + * property will not be set on \p dapl_id and the + * parameter will come from the file access + * property list. + * \param[in] rdcc_w0 The chunk preemption policy for this dataset. + * This must be between 0 and 1 inclusive and + * indicates the weighting according to which chunks + * which have been fully read or written are + * penalized when determining which chunks to flush + * from cache. A value of 0 means fully read or + * written chunks are treated no differently than + * other chunks (the preemption is strictly LRU) + * while a value of 1 means fully read or written + * chunks are always preempted before other chunks. + * If your application only reads or writes data + * once, this can be safely set to 1. Otherwise, + * this should be set lower, depending on how often + * you re-read or re-write the same data. + * The default value is 0.75. If the value passed is + * #H5D_CHUNK_CACHE_W0_DEFAULT, then the property + * will not be set on \p dapl_id and the parameter + * will come from the file access property list. + * + * \return \herr_t + * + * \details H5Pset_chunk_cache() sets the number of elements, the total + * number of bytes, and the preemption policy value in the raw + * data chunk cache on a dataset access property list. After + * calling this function, the values set in the property list + * will override the values in the file's file access property + * list. + * + * The raw data chunk cache inserts chunks into the cache + * by first computing a hash value using the address of a chunk, + * then using that hash value as the chunk's index into the table + * of cached chunks. The size of this hash table, i.e., and the + * number of possible hash values, is determined by the + * \p rdcc_nslots parameter. If a different chunk in the cache + * has the same hash value, this causes a collision, which + * reduces efficiency. If inserting the chunk into cache would + * cause the cache to be too big, then the cache is pruned + * according to the \p rdcc_w0 parameter. + * + * \b Motivation: H5Pset_chunk_cache() is used to adjust the chunk + * cache parameters on a per-dataset basis, as opposed to a global + * setting for the file using H5Pset_cache(). The optimum chunk + * cache parameters may vary widely with different data layout and + * access patterns, so for optimal performance they must be set + * individually for each dataset. It may also be beneficial to + * reduce the size of the chunk cache for datasets whose + * performance is not important in order to save memory space. + * + * \b Example \b Usage: The following code sets the chunk cache to + * use a hash table with 12421 elements and a maximum size of + * 16 MB, while using the preemption policy specified for the + * entire file: + * \Code{ + * H5Pset_chunk_cache(dapl_id, 12421, 16*1024*1024, + * H5D_CHUNK_CACHE_W0_DEFAULT);} + * + * \b Usage \b Notes: The chunk cache size is a property for + * accessing a dataset and is not stored with a dataset or a + * file. To guarantee the same chunk cache settings each time + * the dataset is opened, call H5Dopen() with a dataset access + * property list where the chunk cache size is set by calling + * H5Pset_chunk_cache() for that property list. The property + * list can be used for multiple accesses in the same + * application. + * + * For files where the same chunk cache size will be + * appropriate for all or most datasets, H5Pset_cache() can + * be called with a file access property list to set the + * chunk cache size for accessing all datasets in the file. + * + * Both methods can be used in combination, in which case + * the chunk cache size set by H5Pset_cache() will apply + * except for specific datasets where H5Dopen() is called + * with dataset property list with the chunk cache size + * set by H5Pset_chunk_cache(). + * + * In the absence of any cache settings, H5Dopen() will + * by default create a 1 MB chunk cache for the opened + * dataset. If this size happens to be appropriate, no + * call will be needed to either function to set the + * chunk cache size. + * + * It is also possible that a change in access pattern + * for later access to a dataset will change the + * appropriate chunk cache size. + * + * \since 1.8.3 + * + */ +H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0); +/** + * \ingroup DAPL + * + * \brief Sets the external dataset storage file prefix in the dataset + * access property list + * + * \dapl_id + * \param[in] prefix Dataset external storage prefix in UTF-8 or ASCII + * (<em>Path and filename must be ASCII on Windows systems.</em>) + * + * \return \herr_t + * + * \details H5Pset_efile_prefix() sets the prefix used to locate raw data + * files for a dataset that uses external storage. This prefix + * can provide either an absolute path or a relative path to the + * external files. + * + * H5Pset_efile_prefix() is used in conjunction with + * H5Pset_external() to control the behavior of the HDF5 library + * when searching for the raw data files associated with a dataset + * that uses external storage: + * + * \li The default behavior of the library is to search for the + * dataset’s external storage raw data files in the same + * directory as the HDF5 file which contains the dataset. + * \li If the prefix is set to an absolute path, the target + * directory will be searched for the dataset’s external + * storage raw data files. + * \li If the prefix is set to a relative path, the target + * directory, relative to the current working directory, will + * be searched for the dataset’s external storage raw data + * files. + * \li If the prefix is set to a relative path that begins with + * the special token ${ORIGIN}, that directory, relative to + * the HDF5 file containing the dataset, will be searched for + * the dataset’s external storage raw data files. + * + * The HDF5_EXTFILE_PREFIX environment variable can be used to + * override the above behavior (the environment variable + * supersedes the API call). Setting the variable to a path + * string and calling H5Dcreate() or H5Dopen() is the equivalent + * of calling H5Pset_efile_prefix() and calling the same create + * or open function. The environment variable is checked at the + * time of the create or open action and copied so it can be + * safely changed after the H5Dcreate() or H5Dopen() call. + * + * Calling H5Pset_efile_prefix() with \p prefix set to NULL or + * the empty string returns the search path to the default. The + * result would be the same as if H5Pset_efile_prefix() had never + * been called. + * + * \note If the external file prefix is not an absolute path and the HDF5 + * file is moved, the external storage files will also need to be + * moved so they can be accessed at the new location. + * + * \note As stated above, the use of the HDF5_EXTFILE_PREFIX environment + * variable overrides any property list setting. + * H5Pset_efile_prefix() and H5Pget_efile_prefix(), being property + * functions, set and retrieve only the property list setting; they + * are unaware of the environment variable. + * + * \note On Windows, the prefix must be an ASCII string since the Windows + * standard C library’s I/O functions cannot handle UTF-8 file names. + * + * \since 1.10.0, 1.8.17 + * + */ +H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char *prefix); +/** + * \ingroup DAPL + * + * \brief Sets prefix to be applied to VDS source file paths + * + * \dapl_id + * \param[in] prefix Prefix to be applied to VDS source file paths + * + * \return \herr_t + * + * \details H5Pset_virtual_prefix() sets the prefix to be applied to the + * path of any VDS source files traversed. The prefix is prepended + * to the filename stored in the VDS virtual file, set with + * H5Pset_virtual(). + * + * The prefix is specified in the user-allocated buffer \p prefix + * and set in the dataset access property list \p dapl_id. The + * buffer should not be freed until the property list has been + * closed. + * + * \see_virtual + * + * \since 1.10.2 + * + */ +H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix); +/** + * \ingroup DAPL + * + * \brief Sets the maximum number of missing source files and/or datasets + * with the printf-style names when getting the extent of an + * unlimited virtual dataset + * + * \dapl_id + * \param[in] gap_size Maximum number of files and/or datasets allowed to + * be missing for determining the extent of an + * unlimited virtual dataset with printf-style + * mappings (<em>Default value</em>: 0) + * + * \return \herr_t + * + * \details H5Pset_virtual_printf_gap() sets the access property list for + * the virtual dataset, \p dapl_id, to instruct the library to + * stop looking for the mapped data stored in the files and/or + * datasets with the printf-style names after not finding + * \p gap_size files and/or datasets. The found source files and + * datasets will determine the extent of the unlimited virtual + * dataset with the printf-style mappings. + * + * Consider the following examples where the regularly spaced + * blocks of a virtual dataset are mapped to datasets with the + * names d-1, d-2, d-3, ..., d-N, ... : + * + * \li If the dataset d-2 is missing and \p gap_size is set to 0, + * then the virtual dataset will contain only data found + * in d-1. + * \li If d-2 and d-3 are missing and \p gap_size is set to 2, + * then the virtual dataset will contain the data from + * d-1, d-3, ..., d-N, ... . The blocks that are mapped to + * d-2 and d-3 will be filled according to the virtual + * dataset’s fill value setting. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size); +/** + * \ingroup DAPL + * + * \brief Sets the view of the virtual dataset (VDS) to include or exclude + * missing mapped elements + * + * \dapl_id + * \param[in] view Flag specifying the extent of the data to be included + * in the view. Valid values are: + * \li #H5D_VDS_FIRST_MISSING: View includes all data + * before the first missing mapped data + * \li #H5D_VDS_LAST_AVAILABLE View includes all + * available mapped data + * + * \return \herr_t + * + * \details H5Pset_virtual_view() takes the access property list for the + * virtual dataset, \p dapl_id, and the flag, \p view, and sets + * the VDS view according to the flag value. + * + * If \p view is set to #H5D_VDS_FIRST_MISSING, the view includes + * all data before the first missing mapped data. This setting + * provides a view containing only the continuous data starting + * with the dataset’s first data element. Any break in + * continuity terminates the view. + * + * If \p view is set to #H5D_VDS_LAST_AVAILABLE, the view + * includes all available mapped data. + * + * Missing mapped data is filled with the fill value set in the + * VDS creation property list. + * + * \see_virtual + * + * \since 1.10.0 + * + */ +H5_DLL herr_t H5Pset_virtual_view(hid_t dapl_id, H5D_vds_view_t view); /* Dataset xfer property list (DXPL) routines */ -H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char *expression); -H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size); -H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); -H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/); -H5_DLL herr_t H5Pset_preserve(hid_t plist_id, hbool_t status); -H5_DLL int H5Pget_preserve(hid_t plist_id); -H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check); +/** + * + * \ingroup DXPL + * + * \brief Gets B-tree split ratios for a dataset transfer property list + * + * \dxpl_id{plist_id} + * \param[out] left The B-tree split ratio for left-most nodes + * \param[out] middle The B-tree split ratio for right-most nodes and lone nodes + * \param[out] right The B-tree split ratio for all other nodes + * \return \herr_t + * + * \details H5Pget_btree_ratios() returns the B-tree split ratios for a dataset + * transfer property list. + * + * The B-tree split ratios are returned through the non-NULL arguments + * \p left, \p middle, and \p right, as set by the H5Pset_btree_ratios() + * function. + * + */ +H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/, + double *right /*out*/); +/** + * + * \ingroup DXPL + * + * \brief Reads buffer settings + * + * \param[in] plist_id Identifier for the dataset transfer property list + * \param[out] tconv Address of the pointer to application-allocated type + * conversion buffer + * \param[out] bkg Address of the pointer to application-allocated + * background buffer + * + * \return Returns buffer size, in bytes, if successful; otherwise 0 on failure. + * + * \details H5Pget_buffer() reads values previously set with H5Pset_buffer(). + * + * \version 1.6.0 The return type changed from \p hsize_t to \p size_t. + * \version 1.4.0 The return type changed to \p hsize_t. + * + */ +H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/); +/** + * + * \ingroup DXPL + * + * \brief Retrieves a data transform expression + * + * \param[in] plist_id Identifier of the property list or class + * \param[out] expression Pointer to memory where the transform expression will + * be copied + * \param[in] size Number of bytes of the transform expression to copy + * to + * + * \return Success: the size of the transform expression. Failure: a negative + * value. + * + * \details H5Pget_data_transform() retrieves the data transform expression + * previously set in the dataset transfer property list \p plist_id + * by H5Pset_data_transform(). + * + * H5Pget_data_transform() can be used to both retrieve the transform + * expression and query its size. + * + * If \p expression is non-NULL, up to \p size bytes of the data + * transform expression are written to the buffer. If \p expression + * is NULL, \p size is ignored, and the function does not write + * anything to the buffer. The function always returns the size of + * the data transform expression. + * + * If 0 is returned for the size of the expression, no data transform + * expression exists for the property list. + * + * If an error occurs, the buffer pointed to by \p expression is + * unchanged, and the function returns a negative value. + * + * \par Example + * An example snippet from examples/h5_dtransform.c: + * \snippet h5_dtransform.c H5Pget_data_transform_snip + * + * \since 1.8.0 + * + */ +H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size); +/** + * + * \ingroup DXPL + * + * \brief Determines whether error-detection is enabled for dataset reads + * + * \param[in] plist_id Dataset transfer property list identifier + * + * \return Returns \p H5Z_ENABLE_EDC or \p H5Z_DISABLE_EDC if successful; + * otherwise returns a negative value. + * + * \details H5Pget_edc_check() queries the dataset transfer property + * list \p plist to determine whether error detection is enabled for + * data read operations. + * + * \since 1.6.0 + * + */ H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id); -H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data); -H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right); -H5_DLL herr_t H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/, - double *right /*out*/); -H5_DLL herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info, - H5MM_free_t free_func, void *free_info); -H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info, - H5MM_free_t *free_func, void **free_info); -H5_DLL herr_t H5Pset_hyper_vector_size(hid_t fapl_id, size_t size); -H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/); -H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void *operate_data); -H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data); +/** + * + * \ingroup DXPL + * + * \brief Retrieves number of I/O vectors to be read/written in hyperslab I/O + * + * \param[in] fapl_id Dataset transfer property list identifier + * \param[out] size Number of I/O vectors to accumulate in memory for I/O operations + * + * \return \herr_t + * + * \details H5Pget_hyper_vector_size() retrieves the number of I/O vectors to be accumulated in + * memory before being issued to the lower levels of the HDF5 library for reading or + * writing the actual data. + * + * The number of I/O vectors set in the dataset transfer property list \p fapl_id is + * returned in \p size. Unless the default value is in use, \p size was + * previously set with a call to H5Pset_hyper_vector_size(). + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pget_hyper_vector_size(hid_t fapl_id, size_t *size /*out*/); +/** + * + * \ingroup DXPL + * + * \brief Checks status of the dataset transfer property list (\b DEPRECATED) + * + * \deprecated{H5Pget_preserve() is deprecated as it is no longer useful; + * compound datatype field preservation is now core functionality + * in the HDF5 library.} + * + * \param[in] plist_id Identifier for the dataset transfer property list + * + * \return Returns 1 or 0 if successful; otherwise returns a negative value. + * + * \details H5Pget_preserve() checks the status of the dataset transfer + * property list. + * + * \version 1.6.0 The flag parameter was changed from INTEGER to LOGICAL to + * better match the C API. (Fortran 90) + * + */ +H5_DLL int H5Pget_preserve(hid_t plist_id); +/** + * + * \ingroup DXPL + * + * \brief Gets user-defined datatype conversion callback function + * + * \param[in] dxpl_id Dataset transfer property list identifier + * \param[out] op User-defined type conversion callback function + * \param[out] operate_data User-defined input data for the callback function + * + * \return \herr_t + * + * \details H5Pget_type_conv_cb() gets the user-defined datatype conversion + * callback function \p op in the dataset transfer property list + * \p dxpl_id. + * + * The parameter \p operate_data is a pointer to user-defined input + * data for the callback function. + * + * The callback function \p op defines the actions an application is + * to take when there is an exception during datatype conversion. + * + * Please refer to the function H5Pset_type_conv_cb() for more details. + * + */ +H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, void **operate_data); +/** + * + * \ingroup DXPL + * + * \brief Gets the memory manager for variable-length datatype allocation in H5Dread() and H5Dvlen_reclaim() + * + * \param[in] plist_id Identifier for the dataset transfer property list + * \param[out] alloc_func User's allocate routine, or NULL for system malloc + * \param[out] alloc_info Extra parameter for user’s allocation routine. + * Contents are ignored if preceding + * parameter is NULL \param[out] free_func User's free routine, or NULL for + * system free \param[out] free_info + * Extra parameter for user’s free routine. Contents are ignored if preceding + * parameter is NULL + * + * \return \herr_t + * + * \details H5Pget_vlen_mem_manager() is the companion function to + * H5Pset_vlen_mem_manager(), returning the parameters set by + * that function. + * + */ +H5_DLL herr_t H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func, void **alloc_info, + H5MM_free_t *free_func, void **free_info); +/** + * + * \ingroup DXPL + * + * \brief Sets B-tree split ratios for a dataset transfer property list + * + * \param[in] plist_id The dataset transfer property list identifier + * \param[in] left The B-tree split ratio for left-most nodes + * \param[in] middle The B-tree split ratio for all other nodes + * \param[in] right The B-tree split ratio for right-most nodes and lone + * nodes + * + * \return \herr_t + * + * \details H5Pset_btree_ratios() sets the B-tree split ratios for a dataset + * transfer property list. The split ratios determine what percent of + * children go in the first node when a node splits. + * + * The ratio \p left is used when the splitting node is the left-most + * node at its level in the tree; + * the ratio \p right is used when the splitting node is the right-most + * node at its level; and + * the ratio \p middle is used for all other cases. + * + * A node that is the only node at its level in the tree uses the + * ratio \p right when it splits. + * + * All ratios are real numbers between 0 and 1, inclusive. + * + */ +H5_DLL herr_t H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right); + +/** + * + * \ingroup DXPL + * + * \brief Sets type conversion and background buffers + * + * \dxpl_id{plist_id} + * \param[in] size Size, in bytes, of the type conversion and background buffers + * \param[in] tconv Pointer to application-allocated type conversion buffer + * \param[in] bkg Pointer to application-allocated background buffer + * \return \herr_t + * + * \details Given a dataset transfer property list, H5Pset_buffer() sets the + * maximum size for the type conversion buffer and background buffer + * and optionally supplies pointers to application-allocated + * buffers. If the buffer size is smaller than the entire amount of + * data being transferred between the application and the file, and a + * type conversion buffer or background buffer is required, then strip + * mining will be used. + * + * Note that there are minimum size requirements for the buffer. Strip + * mining can only break the data up along the first dimension, so the + * buffer must be large enough to accommodate a complete slice that + * encompasses all of the remaining dimensions. For example, when strip + * mining a \Code{100x200x300} hyperslab of a simple data space, the + * buffer must be large enough to hold \Code{1x200x300} data + * elements. When strip mining a \Code{100x200x300x150} hyperslab of a + * simple data space, the buffer must be large enough to hold + * \Code{1x200x300x150} data elements. + * + * If \p tconv and/or \p bkg are null pointers, then buffers will be + * allocated and freed during the data transfer. + * + * The default value for the maximum buffer is 1 MiB. + * + * \version 1.6.0 The \p size parameter has changed from type hsize_t to \c size_t. + * \version 1.4.0 The \p size parameter has changed to type hsize_t. + * + */ +H5_DLL herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); + +/** + * \ingroup DXPL + * + * \brief Sets a data transform expression + * + * \dxpl_id{plist_id} + * \param[in] expression Pointer to the null-terminated data transform + * expression + * \return \herr_t + * + * \details H5Pset_data_transform() sets the data transform to be used for + * reading and writing data. This function operates on the dataset + * transfer property list \p plist_id. + * + * The \p expression parameter is a string containing an algebraic + * expression, such as \Code{(5/9.0)*(x-32)} or \Code{x*(x-5)}. When a + * dataset is read or written with this property list, the transform + * expression is applied with the \c x being replaced by the values in + * the dataset. When reading data, the values in the file are not + * changed and the transformed data is returned to the user. + * + * Data transforms can only be applied to integer or + * floating-point datasets. Order of operations is obeyed and + * the only supported operations are +, -, *, and /. Parentheses + * can be nested arbitrarily and can be used to change precedence. + * When writing data back to the dataset, the transformed data is + * written to the file and there is no way to recover the original + * values to which the transform was applied. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char *expression); + +/** + * \ingroup DXPL + * + * \brief Sets the dataset transfer property list to enable or disable error + * detection when reading data + * + * \dxpl_id{plist_id} + * \param[in] check Specifies whether error checking is enabled or disabled + * for dataset read operations + * \return \herr_t + * + * \details H5Pset_edc_check() sets the dataset transfer property list \p plist + * to enable or disable error detection when reading data. + * + * Whether error detection is enabled or disabled is specified in the + * \p check parameter. Valid values are #H5Z_ENABLE_EDC (default) and + * #H5Z_DISABLE_EDC. + * + * \note The initial error detection implementation, Fletcher32 checksum, + * supports error detection for chunked datasets only. + * + * \attention The Fletcher32 EDC checksum filter, set with H5Pset_fletcher32(), + * was added in HDF5 Release 1.6.0. In the original implementation, + * however, the checksum value was calculated incorrectly on + * little-endian systems. The error was fixed in HDF5 Release 1.6.3.\n + * As a result of this fix, an HDF5 library of Release 1.6.0 through + * Release 1.6.2 cannot read a dataset created or written with + * Release 1.6.3 or later if the dataset was created with the + * checksum filter and the filter is enabled in the reading + * library. (Libraries of Release 1.6.3 and later understand the + * earlier error and compensate appropriately.)\n + * \Bold{Work-around:} An HDF5 library of Release 1.6.2 or earlier + * will be able to read a dataset created or written with the + * checksum filter by an HDF5 library of Release 1.6.3 or later if + * the checksum filter is disabled for the read operation. This can + * be accomplished via an H5Pset_edc_check() call with the value + * #H5Z_DISABLE_EDC in the second parameter. This has the obvious + * drawback that the application will be unable to verify the + * checksum, but the data does remain accessible. + * + * \version 1.6.3 Error in checksum calculation on little-endian systems + * corrected in this release. + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check); + +/** + * \ingroup DXPL + * + * \brief Sets user-defined filter callback function + * + * \dxpl_id{plist_id} + * \param[in] func User-defined filter callback function + * \param[in] op_data User-defined input data for the callback function + * \return \herr_t + * + * \details H5Pset_filter_callback() sets the user-defined filter callback + * function \p func in the dataset transfer property list \p plist_id. + * + * The parameter \p op_data is a pointer to user-defined input data for + * the callback function and will be passed through to the callback + * function. + * + * The callback function \p func defines the actions an application is + * to take when a filter fails. The function prototype is as follows: + * \snippet H5Zpublic.h H5Z_filter_func_t_snip + * where \c filter indicates which filter has failed, \c buf and \c buf_size + * are used to pass in the failed data, and op_data is the required + * input data for this callback function. + * + * Valid callback function return values are #H5Z_CB_FAIL and #H5Z_CB_CONT. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data); + +/** + * \ingroup DXPL + * + * \brief Sets number of I/O vectors to be read/written in hyperslab I/O + * + * \dxpl_id{plist_id} + * \param[in] size Number of I/O vectors to accumulate in memory for I/O + * operations\n + * Must be greater than 1 (one)\n + * Default value: 1024 + * \return \herr_t + * + * \details H5Pset_hyper_vector_size() sets the number of I/O vectors to be + * accumulated in memory before being issued to the lower levels of + * the HDF5 library for reading or writing the actual data. + * + * The I/O vectors are hyperslab offset and length pairs and are + * generated during hyperslab I/O. + * + * The number of I/O vectors is passed in \p size to be set in the + * dataset transfer property list \p plist_id. \p size must be + * greater than 1 (one). + * + * H5Pset_hyper_vector_size() is an I/O optimization function; + * increasing vector_size should provide better performance, but the + * library will use more memory during hyperslab I/O. The default value + * of \p size is 1024. + * + * \since 1.6.0 + * + */ +H5_DLL herr_t H5Pset_hyper_vector_size(hid_t plist_id, size_t size); + +/** + * \ingroup DXPL + * + * \brief Sets the dataset transfer property list \p status + * + * \dxpl_id{plist_id} + * \param[in] status Status toggle of the dataset transfer property list + * \return \herr_t + * + * \deprecated This function is deprecated as it no longer has any effect; + * compound datatype field preservation is now core functionality in + * the HDF5 library. + * + * \details H5Pset_preserve() sets the dataset transfer property list status to + * \c 1 or \c 0. + * + * When reading or writing compound datatypes and the destination is + * partially initialized and the read/write is intended to initialize + * the other members, one must set this property to \c 1. Otherwise the + * I/O pipeline treats the destination datapoints as completely + * uninitialized. + * + * \todo Add missing version information: introduction, deprecation, etc. + * Why is the declaration not in the deprecated section? + * + */ +H5_DLL herr_t H5Pset_preserve(hid_t plist_id, hbool_t status); + +/** + * \ingroup DXPL + * + * \brief Sets user-defined datatype conversion callback function + * + * \dxpl_id + * \param[in] op User-defined type conversion callback function + * \param[in] operate_data User-defined input data for the callback function + * \return \herr_t + * + * \details H5Pset_type_conv_cb() sets the user-defined datatype conversion + * callback function \p op in the dataset transfer property list \p + * dxpl_id + * + * The parameter operate_data is a pointer to user-defined input data + * for the callback function and will be passed through to the callback + * function. + * + * The callback function \p op defines the actions an application is to + * take when there is an exception during datatype conversion. The + * function prototype is as follows: + * \snippet H5Tpublic.h H5T_conv_except_func_t_snip + * + * \todo Add version information. + * + */ +H5_DLL herr_t H5Pset_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t op, void *operate_data); + +/** + * \ingroup DXPL + * + * \brief Sets the memory manager for variable-length datatype allocation in + * H5Dread() and H5Dvlen_reclaim() + * + * \dxpl_id{plist_id} + * \param[in] alloc_func User's allocate routine, or \c NULL for system \c malloc + * \param[in] alloc_info Extra parameter for user's allocation routine. + * Contents are ignored if preceding parameter is \c NULL. + * \param[in] free_func User's free routine, or \c NULL for system \c free + * \param[in] free_info Extra parameter for user's free routine. Contents are + * ignored if preceding parameter is \c NULL + * \return \herr_t + * + * \details H5Pset_vlen_mem_manager() sets the memory manager for + * variable-length datatype allocation in H5Dread() and free in + * H5Dvlen_reclaim(). + * + * The \p alloc_func and \p free_func parameters identify the memory + * management routines to be used. If the user has defined custom + * memory management routines, \p alloc_func and/or free_func should be + * set to make those routine calls (i.e., the name of the routine is + * used as the value of the parameter); if the user prefers to use the + * system's \c malloc and/or \c free, the \p alloc_func and \p + * free_func parameters, respectively, should be set to \c NULL + * + * The prototypes for these user-defined functions are as follows: + * \snippet H5MMpublic.h H5MM_allocate_t_snip + * + * \snippet H5MMpublic.h H5MM_free_t_snip + * + * The \p alloc_info and \p free_info parameters can be used to pass + * along any required information to the user's memory management + * routines. + * + * In summary, if the user has defined custom memory management + * routines, the name(s) of the routines are passed in the \p + * alloc_func and \p free_func parameters and the custom routines' + * parameters are passed in the \p alloc_info and \p free_info + * parameters. If the user wishes to use the system \c malloc and \c + * free functions, the \p alloc_func and/or \p free_func parameters are + * set to \c NULL and the \p alloc_info and \p free_info parameters are + * ignored. + * + * \todo Add version information. + */ +H5_DLL herr_t H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_info, + H5MM_free_t free_func, void *free_info); + #ifdef H5_HAVE_PARALLEL +/** + * \ingroup DXPL + * + * \brief Retrieves the type of chunk optimization that HDF5 actually performed + * on the last parallel I/O call (not necessarily the type requested) + * + * \dxpl_id{plist_id} + * \param[out] actual_chunk_opt_mode The type of chunk optimization performed by HDF5 + * \return \herr_t + * + * \par Motivation: + * A user can request collective I/O via a data transfer property list + * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio(). + * However, HDF5 will sometimes ignore this request and perform independent + * I/O instead. This property allows the user to see what kind of I/O HDF5 + * actually performed. Used in conjunction with H5Pget_mpio_actual_io_mode(), + * this property allows the user to determine exactly what HDF5 did when + * attempting collective I/O. + * + * \details H5Pget_mpio_actual_chunk_opt_mode() retrieves the type of chunk + * optimization performed when collective I/O was requested. This + * property is set before I/O takes place, and will be set even if I/O + * fails. + * + * Valid values returned in \p actual_chunk_opt_mode: + * \snippet this H5D_mpio_actual_chunk_opt_mode_t_snip + * \click4more + * + * \since 1.8.8 + * + */ H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); +/** + * \ingroup DXPL + * + * \brief Retrieves the type of I/O that HDF5 actually performed on the last + * parallel I/O call (not necessarily the type requested) + * + * \dxpl_id{plist_id} + * \param[out] actual_io_mode The type of I/O performed by this process + * \return \herr_t + * + * \par Motivation: + * A user can request collective I/O via a data transfer property list + * (DXPL) that has been suitably modified with H5Pset_dxpl_mpio(). + * However, HDF5 will sometimes ignore this request and perform independent + * I/O instead. This property allows the user to see what kind of I/O HDF5 + * actually performed. Used in conjunction with H5Pget_mpio_actual_chunk_opt_mode(), + * this property allows the user to determine exactly HDF5 did when + * attempting collective I/O. + * + * \details H5Pget_mpio_actual_io_mode() retrieves the type of I/O performed on + * the selection of the current process. This property is set after all + * I/O is completed; if I/O fails, it will not be set. + * + * Valid values returned in \p actual_io_mode: + * \snippet this H5D_mpio_actual_io_mode_t_snip + * \click4more + * + * \attention All processes do not need to have the same value. For example, if + * I/O is being performed using the multi chunk optimization scheme, + * one process's selection may include only chunks accessed + * collectively, while another may include chunks accessed + * independently. In this case, the first process will report + * #H5D_MPIO_CHUNK_COLLECTIVE while the second will report + * #H5D_MPIO_CHUNK_INDEPENDENT. + * + * \see H5Pget_mpio_no_collective_cause(), H5Pget_mpio_actual_chunk_opt_mode() + * + * \since 1.8.8 + * + */ H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); +/** + * \ingroup DXPL + * + * \brief Retrieves local and global causes that broke collective I/O on the last + * parallel I/O call + * + * \dxpl_id{plist_id} + * \param[out] local_no_collective_cause An enumerated set value indicating the + * causes that prevented collective I/O in the local process + * \param[out] global_no_collective_cause An enumerated set value indicating + * the causes across all processes that prevented collective I/O + * \return \herr_t + * + * \par Motivation: + * A user can request collective I/O via a data transfer property list (DXPL) + * that has been suitably modified with H5P_SET_DXPL_MPIO. However, there are + * conditions that can cause HDF5 to forgo collective I/O and perform + * independent I/O. Such causes can be different across the processes of a + * parallel application. This function allows the user to determine what + * caused the HDF5 library to skip collective I/O locally, that is in the + * local process, and globally, across all processes. + * + * \details H5Pget_mpio_no_collective_cause() serves two purposes. It can be + * used to determine whether collective I/O was used for the last + * preceding parallel I/O call. If collective I/O was not used, the + * function retrieves the local and global causes that broke collective + * I/O on that parallel I/O call. The properties retrieved by this + * function are set before I/O takes place and are retained even when + * I/O fails. + * + * Valid values returned in \p local_no_collective_cause and \p + * global_no_collective_cause are as follows or, if there are multiple + * causes, a bitwise OR of the relevant causes; the numbers in the + * center column are the bitmask values: + * \snippet this H5D_mpio_no_collective_cause_t_snip + * \click4more + * + * \attention Each process determines whether it can perform collective I/O and + * broadcasts the result. Those results are combined to make a + * collective decision; collective I/O will be performed only if all + * processes can perform collective I/O.\n + * If collective I/O was not used, the causes that prevented it are + * reported by individual process by means of an enumerated set. The + * causes may differ among processes, so H5Pget_mpio_no_collective_cause() + * returns two property values. The first value is the one produced + * by the local process to report local causes. This local information + * is encoded in an enumeration, the \ref H5D_mpio_no_collective_cause_t + * described above, with all individual causes combined into a single + * enumeration value by means of a bitwise OR operation. The second + * value reports global causes; this global value is the result of a + * bitwise-OR operation across the values returned by all the processes. + * + * \since 1.8.10 + * + */ H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); #endif /* H5_HAVE_PARALLEL */ /* Link creation property list (LCPL) routines */ -H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd); +/** + * \ingroup ALCAPL + * + * \brief Determines whether property is set to enable creating missing + * intermediate groups + * + * \lcpl_id{plist_id} + * \param[out] crt_intmd Flag specifying whether to create intermediate + * groups upon creation of an object + * + * \return \herr_t + * + * \details H5Pget_create_intermediate_group() determines whether the link + * creation property list \p plist_id is set to allow functions + * that create objects in groups different from the current + * working group to create intermediate groups that may be + * missing in the path of a new or moved object. + * + * Functions that create objects in or move objects to a group + * other than the current working group make use of this + * property. H5Gcreate_anon() and H5Lmove() are examples of such + * functions. + * + * If \p crt_intmd is positive, missing intermediate groups will + * be created; if \p crt_intmd is non-positive, missing intermediate + * groups will not be created. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/); +/** + * \ingroup ALCAPL + * + * \brief Specifies in property list whether to create missing + * intermediate groups + * + * \lcpl_id{plist_id} + * \param[in] crt_intmd Flag specifying whether to create intermediate + * groups upon the creation of an object + * + * \return \herr_t + * + * \details H5Pset_create_intermediate_group() + * + * \since + * + */ +H5_DLL herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd); /* Group creation property list (GCPL) routines */ -H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint); -H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/); -H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense); + +/** + * \ingroup GCPL + * + * \brief Returns the estimated link count and average link name length in a group + * + * \gcpl_id{plist_id} + * \param[out] est_num_entries The estimated number of links in the group + * referenced by \p plist_id + * \param[out] est_name_len The estimated average length of line names in the group + * referenced by \p plist_id + * \return \herr_t + * + * \details H5Pget_est_link_info() retrieves two settings from the group creation + * property list \p plist_id: the estimated number of links that are + * expected to be inserted into a group created with the property list + * and the estimated average length of those link names. + * + * The estimated number of links is returned in \p est_num_entries. The + * limit for \p est_num_entries is 64 K. + * + * The estimated average length of the anticipated link names is returned + * in \p est_name_len. The limit for \p est_name_len is 64 K. + * + * See \ref_group_impls for a discussion of the available types of HDF5 + * group structures. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */, + unsigned *est_name_len /* out */); +/** + * \ingroup GCPL + * + * \brief Queries whether link creation order is tracked and/or indexed in + * a group + * + * \param[in] plist_id Group or file creation property list + * identifier + * \param[out] crt_order_flags Creation order flag(s) + * + * \return \herr_t + * + * \details H5Pget_link_creation_order() queries the group or file creation + * property list, \p plist_id, and returns a flag indicating whether + * link creation order is tracked and/or indexed in a group. + * + * See H5Pset_link_creation_order() for a list of valid creation + * order flags, as passed in \p crt_order_flags, and their + * meanings. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /* out */); +/** + * \ingroup GCPL + * + * \brief Queries the settings for conversion between compact and dense + * groups + * + * \gcpl_id{plist_id} + * \param[out] max_compact Maximum number of links for compact storage + * \param[out] min_dense Minimum number of links for dense storage + * + * \return \herr_t + * + * \details H5Pget_link_phase_change() queries the maximum number of + * entries for a compact group and the minimum number of links + * to require before converting a group to a dense form. + * + * In the compact format, links are stored as messages in the + * group’s header. In the dense format, links are stored in a + * fractal heap and indexed with a version 2 B-tree. + * + * \p max_compact is the maximum number of links to store as + * header messages in the group header before converting the + * group to the dense format. Groups that are in the compact + * format and exceed this number of links are automatically + * converted to the dense format. + * + * \p min_dense is the minimum number of links to store in the + * dense format. Groups which are in dense format and in which + * the number of links falls below this number are automatically + * converted back to the compact format. + * + * In the compact format, links are stored as messages in the + * group’s header. In the dense format, links are stored in a + * fractal heap and indexed with a version 2 B-tree. + * + * See H5Pset_link_phase_change() for a discussion of + * traditional, compact, and dense group storage. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned *min_dense /*out*/); +/** + * \ingroup GCPL + * + * \brief Retrieves the anticipated size of the local heap for original-style + * groups + * + * \gcpl_id{plist_id} + * \param[out] size_hint Anticipated size of local heap + * \return \herr_t + * + * \details H5Pget_local_heap_size_hint() queries the group creation property + * list, \p plist_id, for the anticipated size of the local heap, \p + * size_hint, for original-style groups, i.e., for groups of the style + * used prior to HDF5 Release 1.8.0. See H5Pset_local_heap_size_hint() + * for further discussion. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/); +/** + * \ingroup GCPL + * + * \brief Sets estimated number of links and length of link names in a group + * + * \gcpl_id{plist_id} + * \param[in] est_num_entries Estimated number of links to be inserted into group + * \param[in] est_name_len Estimated average length of link names + * \return \herr_t + * + * \details H5Pset_est_link_info() inserts two settings into the group creation + * property list plist_id: the estimated number of links that are + * expected to be inserted into a group created with the property list + * and the estimated average length of those link names. + * + * The estimated number of links is passed in \p est_num_entries. The + * limit for \p est_num_entries is 64 K. + * + * The estimated average length of the anticipated link names is passed + * in \p est_name_len. The limit for \p est_name_len is 64 K. + * + * The values for these two settings are multiplied to compute the + * initial local heap size (for old-style groups, if the local heap + * size hint is not set) or the initial object header size for + * (new-style compact groups; see \ref_group_impls). Accurately setting + * these parameters will help reduce wasted file space. + * + * If a group is expected to have many links and to be stored in dense + * format, set \p est_num_entries to 0 (zero) for maximum + * efficiency. This will prevent the group from being created in the + * compact format. + * + * See \ref_group_impls for a discussion of the available types of HDF5 + * group structures. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len); -H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* out */, - unsigned *est_name_len /* out */); +/** + * \ingroup GCPL + * + * \brief Sets creation order tracking and indexing for links in a group + * + * \param[in] plist_id Group or file creation property list + * identifier + * \param[out] crt_order_flags Creation order flag(s) + * + * \return \herr_t + * + * \details H5Pset_link_creation_order() sets flags for tracking and + * indexing links on creation order in groups created with the + * group (or file) creation property list \p plist_id. + * + * \p crt_order_flags contains flags with the following meanings: + * + * <table> + * <tr> + * <td>#H5P_CRT_ORDER_TRACKED</td> + * <td>Link creation order is tracked but not necessarily + * indexed</td> + * </tr> + * <tr> + * <td>#H5P_CRT_ORDER_INDEXED</td> + * <td>Link creation order is indexed (requires + * #H5P_CRT_ORDER_TRACKED)</td> + * </tr> + * </table> + * + * The default behavior is that links are tracked and indexed by + * name, and link creation order is neither tracked nor indexed. + * The name is always the primary index for links in a group. + * + * H5Pset_link_creation_order() can be used to set link creation + * order tracking, or to set link creation order tracking and + * indexing. + * + * If (#H5P_CRT_ORDER_TRACKED | #H5P_CRT_ORDER_INDEXED) is + * specified for \p crt_order_flags, then links will be tracked + * and indexed by creation order. The creation order is added as + * a secondary index and enables faster queries and iterations + * by creation order. + * + * If just #H5P_CRT_ORDER_TRACKED is specified for + * \p crt_order_flags, then links will be tracked by creation + * order, but not indexed by creation order. Queries and iterations + * by creation order will work but will be much slower for large + * groups than if #H5P_CRT_ORDER_INDEXED had been included. + * + * \note If a creation order index is to be built, it must be specified in + * the group creation property list. HDF5 currently provides no + * mechanism to turn on link creation order tracking at group + * creation time and to build the index later. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags); -H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /* out */); +/** + * \ingroup GCPL + * + * \brief Sets the parameters for conversion between compact and dense + * groups + * + * \gcpl_id{plist_id} + * \param[in] max_compact Maximum number of links for compact storage + * (\a Default: 8) + * \param[in] min_dense Minimum number of links for dense storage + * (\a Default: 6) + * + * \return \herr_t + * + * \details H5Pset_link_phase_change() sets the maximum number of entries + * for a compact group and the minimum number of links to allow + * before converting a dense group back to the compact format. + * + * \p max_compact is the maximum number of links to store as + * header messages in the group header before converting the + * group to the dense format. Groups that are in compact format + * and which exceed this number of links are automatically + * converted to dense format. + * + * \p min_dense is the minimum number of links to store in the + * dense format. Groups which are in dense format and in which + * the number of links falls below this threshold are + * automatically converted to compact format. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense); +/** + * \ingroup GCPL + * + * \brief Specifies the anticipated maximum size of a local heap + * + * \gcpl_id{plist_id} + * \param[in] size_hint Anticipated maximum size in bytes of local heap + * \return \herr_t + * + * \details H5Pset_local_heap_size_hint() is used with original-style HDF5 + * groups (see “Motivation” below) to specify the anticipated maximum + * local heap size, size_hint, for groups created with the group + * creation property list \p plist_id. The HDF5 library then uses \p + * size_hint to allocate contiguous local heap space in the file for + * each group created with \p plist_id. + * + * For groups with many members or very few members, an appropriate + * initial value of \p size_hint would be the anticipated number of + * group members times the average length of group member names, plus a + * small margin: + * \code + * size_hint = max_number_of_group_members * + * (average_length_of_group_member_link_names + 2) + * \endcode + * If it is known that there will be groups with zero members, the use + * of a group creation property list with \p size_hint set to to 1 (one) + * will guarantee the smallest possible local heap for each of those groups. + * + * Setting \p size_hint to zero (0) causes the library to make a + * reasonable estimate for the default local heap size. + * + * \par Motivation: + * In situations where backward-compatibility is required, specifically, when + * libraries prior to HDF5 Release 1.8.0 may be used to read the file, groups + * must be created and maintained in the original style. This is HDF5’s default + * behavior. If backward compatibility with pre-1.8.0 libraries is not a concern, + * greater efficiencies can be obtained with the new-format compact and indexed + * groups. See <a href="https://portal.hdfgroup.org/display/HDF5/Groups">Group + * implementations in HDF5</a> in the \ref H5G API introduction (at the bottom).\n + * H5Pset_local_heap_size_hint() is useful for tuning file size when files + * contain original-style groups with either zero members or very large + * numbers of members.\n + * The original style of HDF5 groups, the only style available prior to HDF5 + * Release 1.8.0, was well-suited for moderate-sized groups but was not optimized + * for either very small or very large groups. This original style remains the + * default, but two new group implementations were introduced in HDF5 Release 1.8.0: + * compact groups to accommodate zero to small numbers of members and indexed groups + * for thousands or tens of thousands of members ... or millions, if that's what + * your application requires.\n + * The local heap size hint, \p size_hint, is a performance tuning parameter for + * original-style groups. As indicated above, an HDF5 group may have zero, a handful, + * or tens of thousands of members. Since the original style of HDF5 groups stores the + * metadata for all of these group members in a uniform format in a local heap, the size + * of that metadata (and hence, the size of the local heap) can vary wildly from group + * to group. To intelligently allocate space and to avoid unnecessary fragmentation of + * the local heap, it can be valuable to provide the library with a hint as to the local + * heap’s likely eventual size. This can be particularly valuable when it is known that + * a group will eventually have a great many members. It can also be useful in conserving + * space in a file when it is known that certain groups will never have any members. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint); /* Map access property list (MAPL) routines */ #ifdef H5_HAVE_MAP_API +/** + * \ingroup MAPL + * + * \brief Set map iteration hints + * + * \mapl_id + * \param[in] key_prefetch_size Number of keys to prefetch at a time during + * iteration + * \param[in] key_alloc_size The initial size of the buffer allocated to hold + * prefetched keys + * \return \herr_t + * + * \details H5Pset_map_iterate_hints() adjusts the behavior of H5Miterate() when + * prefetching keys for iteration. The \p key_prefetch_size parameter + * specifies the number of keys to prefetch at a time during + * iteration. The \p key_alloc_size parameter specifies the initial + * size of the buffer allocated to hold these prefetched keys. If this + * buffer is too small it will be reallocated to a larger size, though + * this may result in an additional I/O. + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size); +/** + * \ingroup MAPL + * + * \brief Set map iteration hints + * + * \mapl_id + * \param[out] key_prefetch_size Pointer to number of keys to prefetch at a time + * during iteration + * \param[out] key_alloc_size Pointer to the initial size of the buffer allocated + * to hold prefetched keys + * \return \herr_t + * + * \details H5Pget_map_iterate() returns the map iterate hints, \p key_prefetch_size + * and \p key_alloc_size, as set by H5Pset_map_iterate_hints(). + * + * \since 1.12.0 + * + */ H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_t *key_alloc_size /*out*/); #endif /* H5_HAVE_MAP_API */ /* String creation property list (STRCPL) routines */ -H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding); +/** + * \ingroup ALCAPL + * + * \brief Retrieves the character encoding used to create a link or + * attribute name + * + * \param[in] plist_id Link creation or attribute creation property list + * identifier + * \param[out] encoding String encoding character set + * + * \return \herr_t + * + * \details H5Pget_char_encoding() retrieves the character encoding used + * to encode link or attribute names that are created with the + * property list \p plist_id. + * + * Valid values for \p encoding are defined in H5Tpublic.h and + * include the following: + * + * \csets + * + * \note H5Pget_char_encoding() retrieves the character set used for an + * HDF5 link or attribute name while H5Tget_cset() retrieves the + * character set used in a character or string datatype. + * + * \since 1.8.0 + * + */ H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/); +/** + * \ingroup ALCAPL + * + * \brief Sets the character encoding used to encode link and attribute + * names + * + * \param[in] plist_id Link creation or attribute creation property list + * identifier + * \param[in] encoding String encoding character set + * + * \return \herr_t + * + * \details H5Pset_char_encoding() sets the character encoding used for + * the names of links (which provide the names by which objects + * are referenced) or attributes created with the property list + * \p plist_id. + * + * Valid values for encoding include the following: + * \csets + * \details For example, if the character set for the property list + * \p plist_id is set to #H5T_CSET_UTF8, link names pointing to + * objects created with the link creation property list + * \p plist_id will be encoded using the UTF-8 character set. + * Similarly, names of attributes created with the attribute + * creation property list \p plist_id will be encoded as UTF-8. + * + * ASCII and UTF-8 Unicode are the only currently supported + * character encodings. Extended ASCII encodings (for example, + * ISO 8859) are not supported. This encoding policy is not + * enforced by the HDF5 library. Using encodings other than + * ASCII and UTF-8 can lead to compatibility and usability + * problems. + * + * \note H5Pset_char_encoding() sets the character set used for an + * HDF5 link or attribute name while H5Tset_cset() sets the + * character set used in a character or string datatype. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding); /* Link access property list (LAPL) routines */ -H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); -H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks); -H5_DLL herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix); +/** + * \ingroup LAPL + * + * \brief Retrieves the external link traversal file access flag from the + * specified link access property list + * + * \lapl_id + * \param[out] flags File access flag for link traversal + * + * \return \herr_t + * + * \details H5Pget_elink_acc_flags() retrieves the file access flag used + * to open an external link target file from the specified link + * access property list. + * + * Valid values for \p flags include: + * \li #H5F_ACC_RDWR - Files opened through external links will + * be opened with write access + * \li #H5F_ACC_RDONLY - Files opened through external links will + * be opened with read-only access + * \li #H5F_ACC_DEFAULT - Files opened through external links will + * be opened with the same access flag as + * the parent file + * + * The value returned, if it is not #H5F_ACC_DEFAULT, will + * override the default access flag, which is the access flag + * used to open the parent file. + * + * <b>Example Usage:</b> + * The following code retrieves the external link access flag + * settings on the link access property list \p lapl_id into a + * local variable: + * <pre> + * unsigned acc_flags; + * status = H5Pget_elink_acc_flags(lapl_id, &acc_flags); + * </pre> + * + * \since 1.8.3 + * + */ +H5_DLL herr_t H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags); +/** + * \ingroup LAPL + * + * \brief Retrieves the external link traversal callback function from the + * specified link access property list + * + * \lapl_id + * \param[out] func User-defined external link traversal callback + * function + * \param[out] op_data User-defined input data for the callback function + * + * \return \herr_t + * + * \details H5Pget_elink_cb() retrieves the user-defined external link + * traversal callback function defined in the specified link + * access property list. + * + * The callback function may adjust the file access property + * list and file access flag to use when opening a file through + * an external link. The callback will be executed by the HDF5 + * library immediately before opening the target file. + * + * <b>Failure Modes:</b> H5Pget_elink_cb() will fail if the link + * access property list identifier, \p lapl_id, is invalid. + * + * An invalid function pointer or data pointer, \p func or + * \p op_data respectively, may cause a segmentation fault or an + * invalid memory access. + * + * <b>Example Usage:</b> The following code retrieves the external + * link callback settings on the link access property list + * \p lapl_id into local variables: + * <pre> + * H5L_elink_traverse_t elink_callback_func; + * void *elink_callback_udata; + * status = H5Pget_elink_cb (lapl_id, &elink_callback_func, + * &elink_callback_udata); + * </pre> + * + * \since 1.8.3 + * + */ +H5_DLL herr_t H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data); +/** + * \ingroup LAPL + * + * \brief Retrieves the file access property list identifier associated + * with the link access property list + * + * \lapl_id + * + * \return \hid_t{file access property list} + * + * \details H5Pget_elink_fapl() retrieves the file access property list + * identifier that is set for the link access property list + * identifier, \p lapl_id. The library uses this file access + * property list identifier to open the target file for the + * external link access. When no such identifier is set, this + * routine returns #H5P_DEFAULT. + * + * \see H5Pset_elink_fapl() and H5Lcreate_external(). + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Pget_elink_fapl(hid_t lapl_id); +/** + * \ingroup LAPL + * + * \brief Retrieves prefix applied to external link paths + * + * \lapl_id{plist_id} + * \param[out] prefix Prefix applied to external link paths + * \param[in] size Size of prefix, including null terminator + * + * \return If successful, returns a non-negative value specifying the size + * in bytes of the prefix without the NULL terminator; otherwise + * returns a negative value. + * + * \details H5Pget_elink_prefix() retrieves the prefix applied to the + * path of any external links traversed. + * + * When an external link is traversed, the prefix is retrieved + * from the link access property list \p plist_id, returned in + * the user-allocated buffer pointed to by \p prefix, and + * prepended to the filename stored in the external link. + * + * The size in bytes of the prefix, including the NULL terminator, + * is specified in \p size. If size is unknown, a preliminary + * H5Pget_elink_prefix() call with the pointer \p prefix set to + * NULL will return the size of the prefix without the NULL + * terminator. + * + * \since 1.8.0 + * + */ H5_DLL ssize_t H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size); -H5_DLL hid_t H5Pget_elink_fapl(hid_t lapl_id); -H5_DLL herr_t H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id); -H5_DLL herr_t H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags); -H5_DLL herr_t H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags); -H5_DLL herr_t H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data); -H5_DLL herr_t H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data); +/** + * \ingroup LAPL + * + * \brief Retrieves the maximum number of link traversals + * + * \lapl_id{plist_id} + * \param[out] nlinks Maximum number of links to traverse + * + * \return \herr_t + * + * \details H5Pget_nlinks() retrieves the maximum number of soft or + * user-defined link traversals allowed, \p nlinks, before the + * library assumes it has found a cycle and aborts the traversal. + * This value is retrieved from the link access property list + * \p plist_id. + * + * The limit on the number of soft or user-defined link traversals + * is designed to terminate link traversal if one or more links + * form a cycle. User control is provided because some files may + * have legitimate paths formed of large numbers of soft or + * user-defined links. This property can be used to allow + * traversal of as many links as desired. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks); +/** + * \ingroup LAPL + * + * \brief Sets the external link traversal file access flag in a link + * access property list + * + * \lapl_id + * \param[in] flags The access flag for external link traversal + * + * \return \herr_t + * + * \details H5Pset_elink_acc_flags() specifies the file access flag to use + * to open the target file of an external link. This allows + * read-only access of files reached through an external link in + * a file opened with write access, or vice-versa. + * + * Valid values for \p flags include: + * \li #H5F_ACC_RDWR - Causes files opened through external links + * to be opened with write access + * \li #H5F_ACC_RDONLY - Causes files opened through external + * links to be opened with read-only access + * \li #H5F_ACC_DEFAULT - Removes any external link file access + * flag setting from \p lapl_id, causing the file access flag + * setting to be taken from the parent file + * + * The library will normally use the file access flag used to + * open the parent file as the file access flag for the target + * file. This function provides a way to override that behavior. + * The external link traversal callback function set by + * H5Pset_elink_cb() can override the setting from + * H5Pset_elink_acc_flags(). + * + * <b>Motivation:</b> H5Pset_elink_acc_flags() is used to adjust the + * file access flag used to open files reached through external links. + * This may be useful to, for example, prevent modifying files + * accessed through an external link. Otherwise, the target file is + * opened with whatever flag was used to open the parent. + * + * <b>Example Usage:</b> The following code sets the link access + * property list \p lapl_id to open external link target files with + * read-only access: + * <pre> + * status = H5Pset_elink_acc_flags(lapl_id, H5F_ACC_RDONLY); + * </pre> + * + * \since 1.8.3 + * + */ +H5_DLL herr_t H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags); +/** + * \ingroup LAPL + * + * \brief Sets the external link traversal callback function in a link + * access property list + * + * \lapl_id + * \param[in] func User-defined external link traversal callback + * function + * \param[in] op_data User-defined input data for the callback function + * + * \return \herr_t + * + * \details H5Pset_elink_cb() sets a user-defined external link traversal + * callback function in the link access property list \p lapl_id. + * The callback function \p func must conform to the prototype + * specified in #H5L_elink_traverse_t. + * + * The callback function may adjust the file access property + * list and file access flags to use when opening a file through + * an external link. The callback will be executed by the HDF5 + * library immediately before opening the target file. + * + * The callback will be made after the file access property list + * set by H5Pset_elink_fapl() and the file access flag set by + * H5Pset_elink_acc_flags() are applied, so changes made by this + * callback function will take precedence. + * + * \attention A file close degree property setting (H5Pset_fclose_degree()) + * in this callback function or an associated property list will + * be ignored. A file opened by means of traversing an external + * link is always opened with the weak file close degree + * property setting, #H5F_CLOSE_WEAK. + * + * <b>Motivation:</b> H5Pset_elink_cb() is used to specify a + * callback function that is executed by the HDF5 library when + * traversing an external link. This provides a mechanism to set + * specific access permissions, modify the file access property + * list, modify the parent or target file, or take any other + * user-defined action. This callback function is used in + * situations where the HDF5 library's default behavior is not + * suitable. + * + * <b>Failure Modes:</b> H5Pset_elink_cb() will fail if the link + * access property list identifier, \p lapl_id, is invalid or if + * the function pointer, \p func, is NULL. + * + * An invalid function pointer, \p func, will cause a segmentation + * fault or other failure when an attempt is subsequently made to + * traverse an external link. + * + * <b>Example Usage:</b> + * This example defines a callback function that prints the name + * of the target file every time an external link is followed, and + * sets this callback function on \p lapl_id. + * <pre> + * herr_t elink_callback(const char *parent_file_name, const char + * *parent_group_name, const char *child_file_name, const char + * *child_object_name, unsigned *acc_flags, hid_t fapl_id, void *op_data) { + * puts(child_file_name); + * return 0; + * } + * int main(void) { + * hid_t lapl_id = H5Pcreate(H5P_LINK_ACCESS); + * H5Pset_elink_cb(lapl_id, elink_callback, NULL); + * ... + * } + * </pre> + * + * + * \since 1.8.3 + * + */ +H5_DLL herr_t H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data); +/** + * \ingroup LAPL + * + * \brief Sets a file access property list for use in accessing a file + * pointed to by an external link + * + * \lapl_id + * \fapl_id + * + * \return \herr_t + * + * \details H5Pset_elink_fapl() sets the file access property list, + * \p fapl_id, to be used when accessing the target file of an + * external link associated with \p lapl_id. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id); +/** + * \ingroup LAPL + * + * \brief Sets prefix to be applied to external link paths + * + * \lapl_id{plist_id} + * \param[in] prefix Prefix to be applied to external link paths + * + * \return \herr_t + * + * \details H5Pset_elink_prefix() sets the prefix to be applied to the + * path of any external links traversed. The prefix is prepended + * to the filename stored in the external link. + * + * The prefix is specified in the user-allocated buffer \p prefix + * and set in the link access property list \p plist_id. The buffer + * should not be freed until the property list has been closed. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix); +/** + * \ingroup LAPL + * + * \brief Sets maximum number of soft or user-defined link traversals + * + * \lapl_id{plist_id} + * \param[in] nlinks Maximum number of links to traverse + * + * \return \herr_t + * + * \details H5Pset_nlinks() sets the maximum number of soft or user-defined + * link traversals allowed, \p nlinks, before the library assumes + * it has found a cycle and aborts the traversal. This value is + * set in the link access property list \p plist_id. + * + * The limit on the number of soft or user-defined link traversals + * is designed to terminate link traversal if one or more links + * form a cycle. User control is provided because some files may + * have legitimate paths formed of large numbers of soft or + * user-defined links. This property can be used to allow + * traversal of as many links as desired. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); /* Object copy property list (OCPYPL) routines */ -H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned crt_intmd); -H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *crt_intmd /*out*/); +/** + * \ingroup OCPPL + * + * \brief Adds a path to the list of paths that will be searched in the + * destination file for a matching committed datatype + * + * \param[in] plist_id Object copy property list identifier + * \param[in] path The path to be added + * + * \return \herr_t + * + * \details H5Padd_merge_committed_dtype_path() adds a path, \p path, + * which points to a committed datatype, to the current list of + * suggested paths stored in the object copy property list + * \p plist_id. The search as described in the next paragraph is + * effective only if the #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG is + * enabled in the object copy property list via + * H5Pset_copy_object(). + * + * When copying a committed datatype, a dataset with a committed + * datatype, or an object with an attribute of a committed + * datatype, the default behavior of H5Ocopy() is to search for + * a matching committed datatype: + * <ol> + * <li> First search the list of suggested paths in the object + * copy property list.</li> + * <li> Then, if no match has been found, search all the committed + * datatypes in the destination file. + * </ol> + * The default Step 2 in this search process can be changed by + * setting a callback function (see H5Pset_mcdt_search_cb()). + * + * Two datatypes are determined equal if their descriptions are + * identical, in a manner similar to H5Tequal(). If either + * committed datatype has one or more attributes, then all + * attributes must be present in both committed datatypes and they + * must be identical. Two attributes are considered identical if + * their datatype description, dataspace, and raw data values are + * the same. However, if an attribute uses a committed datatype, + * that committed datatype’s attributes will not be compared. + * + * If a match is found, H5Ocopy() will perform the following in + * the destination file: + * \li For a committed datatype, the library will create a hard + * link to the found datatype. + * \li For a dataset that uses a committed datatype, the library + * will modify the copied dataset to use the found committed + * datatype as its datatype. + * \li For an object with an attribute of a committed datatype, + * the library will modify the copied object’s attribute to + * use the found committed datatype as its datatype. + * + * If no match is found, H5Ocopy() will perform the following in + * the destination file: + * \li For a committed datatype, the library will copy it as it + * would any other object, creating a named committed + * datatype at the destination. That is, the library will + * create a committed datatype that is accessible in the + * file by a unique path. + * \li For a dataset that uses a committed datatype, the + * library will copy the datatype as an anonymous + * committed datatype and use that as the dataset’s + * datatype. + * \li For an object with an attribute of a committed datatype, + * the library will copy the datatype as an anonymous + * committed datatype and use that as the attribute’s + * datatype. + * + * \b Motivation: H5Padd_merge_committed_dtype_path() provides a + * means to override the default behavior of H5Ocopy() when + * #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG is set in an object + * copy property list. + * H5Padd_merge_committed_dtype_path() is the mechanism for + * suggesting search paths where H5Ocopy() will look for a + * matching committed datatype. This can be substantially + * faster than the default approach of searching the entire + * destination file for a match. + * + * \b Example \b Usage: This example adds two paths to the object + * copy property list. H5Ocopy() will search the two suggested + * paths for a match before searching all the committed datatypes + * in the destination file. + * + * <pre> + * int main(void) { + * hid_t ocpypl_id = H5Pcreate(H5P_OBJECT_COPY); + * + * H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG); + * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA"); + * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group2/committed_dset"); + * H5Ocopy(...ocpypl_id...); + * ... + * ... + * } + * </pre> + * + * \note H5Padd_merge_committed_dtype_path() will fail if the object + * copy property list is invalid. + * It will also fail if there is insufficient memory when + * duplicating \p path. + * + * \see + * \li H5Ocopy() + * \li #H5O_mcdt_search_cb_t + * \li H5Padd_merge_committed_dtype_path() + * \li H5Pfree_merge_committed_dtype_paths() + * \li H5Pget_mcdt_search_cb() + * \li H5Pset_copy_object() + * \li H5Pset_mcdt_search_cb() + * \li \ref_h5ocopy + * + * \since 1.8.9 + * + */ H5_DLL herr_t H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path); +/** + * \ingroup OCPPL + * + * \brief Clears the list of paths stored in the object copy property list + * + * \param[in] plist_id Object copy property list identifier + * + * \return \herr_t + * + * \details H5Pfree_merge_committed_dtype_paths() clears the suggested + * paths stored in the object copy property list \p plist_id. + * These are the suggested paths previously set with + * H5Padd_merge_committed_dtype_path(). + * + * \b Example \b Usage: This example adds a suggested path to the + * object copy property list, does the copy, clears the list, and + * then adds a new suggested path to the list for another copy. + * + * <pre> + * int main(void) { + * hid_t ocpypl_id = H5Pcreate(H5P_OBJECT_COPY); + * + * H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG); + * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA"); + * H5Ocopy(...ocpypl_id...); + * ... + * ... + * H5Pfree_merge_committed_dtype_paths(ocpypl_id); + * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group2/committed_dtypeB"); + * H5Ocopy(...ocpypl_id...); + * ... + * ... + * } + * </pre> + * + * \note H5Pfree_merge_committed_dtype_paths() will fail if the + * object copy property list is invalid. + * + * \see + * \li H5Ocopy() + * \li #H5O_mcdt_search_cb_t + * \li H5Padd_merge_committed_dtype_path() + * \li H5Pfree_merge_committed_dtype_paths() + * \li H5Pget_mcdt_search_cb() + * \li H5Pset_copy_object() + * \li H5Pset_mcdt_search_cb() + * + * \since 1.8.9 + * + */ H5_DLL herr_t H5Pfree_merge_committed_dtype_paths(hid_t plist_id); -H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data); +/** + * \ingroup OCPPL + * + * \brief Retrieves the properties to be used when an object is copied + * + * \param[in] plist_id Object copy property list identifier + * \param[out] copy_options Copy option(s) set in the object copy property + * list + * + * \return \herr_t + * + * \details H5Pget_copy_object() retrieves the properties currently + * specified in the object copy property list \p plist_id, which + * will be invoked when a new copy is made of an existing object. + * + * \p copy_options is a bit map indicating the flags, or + * properties, governing object copying that are set in the + * property list \p plist_id. + * + * The available flags are described in H5Pset_copy_object(). + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *copy_options /*out*/); +/** + * \ingroup OCPPL + * + * \brief Retrieves the callback function from the specified object copy + * property list + * + * \param[in] plist_id Object copy property list identifier + * \param[out] func User-defined callback function + * \param[out] op_data User-defined data for the callback + * function + * + * \return \herr_t + * + * \details H5Pget_mcdt_search_cb() retrieves the user-defined callback + * function and the user data that are set via + * H5Pset_mcdt_search_cb() in the object copy property list + * \p plist_id. + * + * The callback function will be returned in the parameter \p func + * and the user data will be returned in the parameter \p op_data. + * + * \note H5Pget_mcdt_search_cb() will fail if the object copy property + * list is invalid. + * + * \see + * \li H5Ocopy() + * \li #H5O_mcdt_search_cb_t + * \li H5Padd_merge_committed_dtype_path() + * \li H5Pfree_merge_committed_dtype_paths() + * \li H5Pget_mcdt_search_cb() + * \li H5Pset_copy_object() + * \li H5Pset_mcdt_search_cb() + * \li \ref_h5ocopy + * + * \since 1.8.9 + * + */ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data); +/** + * \ingroup OCPPL + * + * \brief Sets properties to be used when an object is copied + * + * \param[in] plist_id Object copy property list identifier + * \param[out] copy_options Copy option(s) to be set + * + * \return \herr_t + * + * \details H5Pset_copy_object() sets properties in the object copy + * property list \p plist_id. When an existing object is copied, + * that property list will determine how the new copy is created. + * + * The following flags are available for use in an object copy + * property list: + * + * <table> + * <tr> + * <td>#H5O_COPY_SHALLOW_HIERARCHY_FLAG</td> + * <td>Copy only immediate members of a group<br /> + * <em>Default behavior, without flag:</em> Recursively + * copy all objects in and below the group.</td> + * </tr> + * <tr> + * <td>#H5O_COPY_EXPAND_SOFT_LINK_FLAG</td> + * <td>Expand soft links into new objects<br /> + * <em>Default behavior, without flag:</em> Copy soft + * links as they are.</td> + * </tr> + * <tr> + * <td>#H5O_COPY_EXPAND_EXT_LINK_FLAG</td> + * <td>Expand external link into new objects<br /> + * <em>Default behavior, without flag:</em> Copy external + * links as they are.</td> + * </tr> + * <tr> + * <td>#H5O_COPY_EXPAND_REFERENCE_FLAG</td> + * <td>Copy objects that are pointed to by references and + * update reference values in destination file<br /> + * <em>Default behavior, without flag:</em> Set reference + * values in destination file to zero (0)</td> + * </tr> + * <tr> + * <td>#H5O_COPY_WITHOUT_ATTR_FLAG</td> + * <td>Copy object without copying attributes<br /> + * <em>Default behavior, without flag:</em> Copy object + * with all its attributes</td> + * </tr> + * <tr> + * <td>#H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG</td> + * <td>Use a matching committed datatype in the destination + * file when copying a committed datatype, a dataset with + * a committed datatype, or an object with an attribute + * of committed datatype <br /> + * <em>Default behavior without flag:</em> + * + * \li A committed datatype in the source will be copied to + * the destination as a committed datatype. + * \li If a dataset in the source uses a committed + * datatype or an object in the source has an attribute + * of a committed datatype, that committed datatype will + * be written to the destination as an anonymous + * committed datatype. + * If copied in a single H5Ocopy() operation, objects + * that share a committed datatype in the source will + * share an anonymous committed dataype in the + * destination copy. Subsequent H5Ocopy() operations, + * however, will be unaware of prior anonymous committed + * dataypes and will create new ones. + * + * See the “See Also” section immediately below for + * functions related to the use of this flag.</td> + * </tr> + * </table> + * + * \see + * Functions and a callback function used to tune committed datatype + * copying behavior: + * \li #H5O_mcdt_search_cb_t + * \li H5Padd_merge_committed_dtype_path() + * \li H5Pfree_merge_committed_dtype_paths() + * \li H5Pget_mcdt_search_cb() + * \li H5Pset_copy_object() + * \li H5Pset_mcdt_search_cb() + * \li \ref_h5ocopy + * + * \version 1.8.9 #H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG added in this release. + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned copy_options); +/** + * \ingroup OCPPL + * + * \brief Sets the callback function that H5Ocopy() will invoke before + * searching the entire destination file for a matching committed + * datatype + * + * \param[in] plist_id Object copy property list identifier + * \param[in] func User-defined callback function + * \param[in] op_data User-defined input data for the callback function + * + * \return \herr_t + * + * \details H5Pset_mcdt_search_cb() allows an application to set a + * callback function, \p func, that will be invoked before + * searching the destination file for a matching committed + * datatype. The default, global search process is described in + * H5Padd_merge_committed_dtype_path(). + * + * The callback function must conform to the #H5O_mcdt_search_cb_t + * prototype and will return an instruction for one of the + * following actions: + * + * \li Continue the search for a matching committed datatype in + * the destination file. + * \li Discontinue the search for a matching committed datatype. + * H5Ocopy() will then apply the default behavior of creating + * an anonymous committed datatype. + * \li Abort the copy operation and exit H5Ocopy(). + * + * \b Motivation: H5Pset_mcdt_search_cb() provides the means to + * define a callback function. An application can then use that + * callback to take an additional action before the default search + * of all committed datatypes in the destination file or to take an + * action that replaces the default search. This mechanism is + * intended to improve performance when the global search might + * take a long time. + * + * \b Example \b Usage: This example defines a callback function in + * the object copy property list. + * + * <pre> + * static H5O_mcdt_search_ret_t + * mcdt_search_cb(void *_udata) + * { + * H5O_mcdt_search_ret_t action = *((H5O_mcdt_search_ret_t *)_udata); + * + * return(action); + * } + * + * int main(void) { + * hid_t ocpypl_id = H5Pcreate(H5P_OBJECT_COPY); + * + * H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG); + * H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA"); + * + * action = H5O_MCDT_SEARCH_STOP; + * H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cb, &action); + * H5Ocopy(...ocpypl_id...); + * ... + * ... + * } + * </pre> + * + * \note H5Pset_mcdt_search_cb() will fail if the + * object copy property list is invalid. + * + * \warning If the callback function return value causes H5Ocopy() to + * abort, the destination file may be left in an inconsistent or + * corrupted state. + * + * \see + * \li H5Ocopy() + * \li #H5O_mcdt_search_cb_t + * \li H5Padd_merge_committed_dtype_path() + * \li H5Pfree_merge_committed_dtype_paths() + * \li H5Pget_mcdt_search_cb() + * \li H5Pset_copy_object() + * \li H5Pset_mcdt_search_cb() + * \li \ref_h5ocopy + * + * \since 1.8.9 + * + */ +H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -1292,39 +9265,316 @@ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, #define H5P_NO_CLASS H5P_ROOT /* Typedefs */ +/** + * \ingroup GPLOA + * + * \brief Registers a permanent property with a property list class + * + * \plistcls_id{cls_id} + * \param[in] name Name of property to register + * \param[in] size Size of property in bytes + * \param[in] def_value Default value for property in newly created + * property lists + * \param[in] prp_create Callback routine called when a property list is + * being created and the property value will be + * initialized + * \param[in] prp_set Callback routine called before a new value is + * copied into the property's value + * \param[in] prp_get Callback routine called when a property value is + * retrieved from the property + * \param[in] prp_del Callback routine called when a property is deleted + * from a property list + * \param[in] prp_copy Callback routine called when a property is copied + * from a property list + * \param[in] prp_close Callback routine called when a property list is + * being closed and the property value will be + * disposed of + * + * \return \herr_t + * + * \deprecated As of HDF5-1.8 this function was deprecated in favor of + * H5Pregister2() or the macro H5Pregister(). + * + * \details H5Pregister1() registers a new property with a property list + * class. The property will exist in all property list objects + * of that class after this routine is finished. The name of + * the property must not already exist. The default property + * value must be provided and all new property lists created + * with this property will have the property value set to the + * default provided. Any of the callback routines may be set + * to NULL if they are not needed. + * + * Zero-sized properties are allowed and do not store any data in + * the property list. These may be used as flags to indicate the + * presence or absence of a particular piece of information. The + * default pointer for a zero-sized property may be set to NULL. + * The property \p prp_create and \p prp_close callbacks are called for + * zero-sized properties, but the \p prp_set and \p prp_get callbacks + * are never called. + * + * The \p prp_create routine is called when a new property list with + * this property is being created. The #H5P_prp_create_func_t + * callback function is defined as #H5P_prp_cb1_t. + * + * The \p prp_create routine may modify the value to be set and those + * changes will be stored as the initial value of the property. + * If the \p prp_create routine returns a negative value, the new + * property value is not copied into the property and the + * \p prp_create routine returns an error value. + * + * The \p prp_set routine is called before a new value is copied into + * the property. The #H5P_prp_set_func_t callback function is defined + * as #H5P_prp_cb2_t. + * + * The \p prp_set routine may modify the value pointer to be set and + * those changes will be used when setting the property's value. + * If the \p prp_set routine returns a negative value, the new property + * value is not copied into the property and the \p prp_set routine + * returns an error value. The \p prp_set routine will not be called + * for the initial value; only the \p prp_create routine will be + * called. + * + * \b Note: The \p prp_set callback function may be useful to range + * check the value being set for the property or may perform some + * transformation or translation of the value set. The \p prp_get + * callback would then reverse the transformation or translation. + * A single \p prp_get or \p prp_set callback could handle multiple + * properties by performing different actions based on the property + * name or other properties in the property list. + * + * The \p prp_get routine is called when a value is retrieved from a + * property value. The #H5P_prp_get_func_t callback function is + * defined as #H5P_prp_cb2_t. + * + * The \p prp_get routine may modify the value to be returned from the + * query and those changes will be returned to the calling routine. + * If the \p prp_set routine returns a negative value, the query + * routine returns an error value. + * + * The \p prp_del routine is called when a property is being + * deleted from a property list. The #H5P_prp_delete_func_t + * callback function is defined as #H5P_prp_cb2_t. + * + * The \p prp_del routine may modify the value passed in, but the + * value is not used by the library when the \p prp_del routine + * returns. If the \p prp_del routine returns a negative value, + * the property list deletion routine returns an error value but + * the property is still deleted. + * + * The \p prp_copy routine is called when a new property list with + * this property is being created through a \p prp_copy operation. + * The #H5P_prp_copy_func_t callback function is defined as + * #H5P_prp_cb1_t. + * + * The \p prp_copy routine may modify the value to be set and those + * changes will be stored as the new value of the property. If + * the \p prp_copy routine returns a negative value, the new + * property value is not copied into the property and the \p prp_copy + * routine returns an error value. + * + * The \p prp_close routine is called when a property list with this + * property is being closed. The #H5P_prp_close_func_t callback + * function is defined as #H5P_prp_cb1_t. + * + * The \p prp_close routine may modify the value passed in, but the + * value is not used by the library when the \p prp_close routine + * returns. If the \p prp_close routine returns a negative value, the + * property list close routine returns an error value but the property + * list is still closed. + * + * The #H5P_prp_cb1_t is as follows: + * \snippet this H5P_prp_cb1_t_snip + * + * The #H5P_prp_cb2_t is as follows: + * \snippet this H5P_prp_cb2_t_snip + * + * + * \cpp_c_api_note + * + */ /* Function prototypes */ H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); +/** + * \ingroup GPLOA + * + * \brief Registers a temporary property with a property list + * + * \plist_id + * \param[in] name Name of property to create + * \param[in] size Size of property in bytes + * \param[in] value Initial value for the property + * \param[in] prp_set Callback routine called before a new value is copied + * into the property's value + * \param[in] prp_get Callback routine called when a property value is + * retrieved from the property + * \param[in] prp_delete Callback routine called when a property is deleted + * from a property list + * \param[in] prp_copy Callback routine called when a property is copied + * from an existing property list + * \param[in] prp_close Callback routine called when a property list is + * being closed and the property value will be disposed + * of + * + * \return \herr_t + * + * \deprecated As of HDF5-1.8 this function was deprecated in favor of + * H5Pinsert2() or the macro H5Pinsert(). + * + * \details H5Pinsert1() creates a new property in a property + * list. The property will exist only in this property list and + * copies made from it. + * + * The initial property value must be provided in \p value and + * the property value will be set accordingly. + * + * The name of the property must not already exist in this list, + * or this routine will fail. + * + * The \p prp_set and \p prp_get callback routines may be set to NULL + * if they are not needed. + * + * Zero-sized properties are allowed and do not store any data + * in the property list. The default value of a zero-size + * property may be set to NULL. They may be used to indicate the + * presence or absence of a particular piece of information. + * + * The \p prp_set routine is called before a new value is copied + * into the property. The #H5P_prp_set_func_t callback function + * is defined as #H5P_prp_cb2_t. + * The \p prp_set routine may modify the value pointer to be set and + * those changes will be used when setting the property's value. + * If the \p prp_set routine returns a negative value, the new property + * value is not copied into the property and the \p set routine + * returns an error value. The \p prp_set routine will be called for + * the initial value. + * + * \b Note: The \p prp_set callback function may be useful to range + * check the value being set for the property or may perform some + * transformation or translation of the value set. The \p prp_get + * callback would then reverse the transformation or translation. + * A single \p prp_get or \p prp_set callback could handle multiple + * properties by performing different actions based on the + * property name or other properties in the property list. + * + * The \p prp_get routine is called when a value is retrieved from + * a property value. The #H5P_prp_get_func_t callback function + * is defined as #H5P_prp_cb2_t. + * + * The \p prp_get routine may modify the value to be returned from + * the query and those changes will be preserved. If the \p prp_get + * routine returns a negative value, the query routine returns + * an error value. + * + * The \p prp_delete routine is called when a property is being + * deleted from a property list. The #H5P_prp_delete_func_t + * callback function is defined as #H5P_prp_cb2_t. + * + * The \p prp_copy routine is called when a new property list with + * this property is being created through a \p prp_copy operation. + * The #H5P_prp_copy_func_t callback function is defined as + * #H5P_prp_cb1_t. + * + * The \p prp_copy routine may modify the value to be set and those + * changes will be stored as the new value of the property. If the + * \p prp_copy routine returns a negative value, the new property value + * is not copied into the property and the prp_copy routine returns an + * error value. + * + * The \p prp_close routine is called when a property list with this + * property is being closed. + * The #H5P_prp_close_func_t callback function is defined as + * #H5P_prp_cb1_t. + * + * The \p prp_close routine may modify the value passed in, the + * value is not used by the library when the close routine + * returns. If the \p prp_close routine returns a negative value, + * the property list \p prp_close routine returns an error value + * but the property list is still closed. + * + * \b Note: There is no \p prp_create callback routine for temporary + * property list objects; the initial value is assumed to + * have any necessary setup already performed on it. + * + * The #H5P_prp_cb1_t is as follows: + * \snippet this H5P_prp_cb1_t_snip + * + * The #H5P_prp_cb2_t is as follows: + * \snippet this H5P_prp_cb2_t_snip + + * \cpp_c_api_note + */ H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); +/** + * \ingroup GPLO + * + * \brief Encodes the property values in a property list into a binary + * buffer + * + * \plist_id + * \param[out] buf Buffer into which the property list will be encoded. + * If the provided buffer is NULL, the size of the + * buffer required is returned through \p nalloc; the + * function does nothing more. + * \param[out] nalloc The size of the required buffer + * + * \return \herr_t + * + * \deprecated As of HDF5-1.12 this function has been deprecated in favor of + * H5Pencode2() or the macro H5Pencode(). + * + * \details H5Pencode1() encodes the property list \p plist_id into the + * binary buffer \p buf. + * + * If the required buffer size is unknown, \p buf can be passed + * in as NULL and the function will set the required buffer size + * in \p nalloc. The buffer can then be created and the property + * list encoded with a subsequent H5Pencode1() call. + * + * If the buffer passed in is not big enough to hold the encoded + * properties, the H5Pencode1() call can be expected to fail with + * a segmentation fault. + * + * Properties that do not have encode callbacks will be skipped. + * There is currently no mechanism to register an encode callback for + * a user-defined property, so user-defined properties cannot currently + * be encoded. + * + * Some properties cannot be encoded, particularly properties that are + * reliant on local context. + * + * \since 1.10.0 + * + */ H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc); /** - *------------------------------------------------------------------------- - * \ingroup OCPL + * \ingroup DCPL * * \brief Returns information about a filter in a pipeline (DEPRECATED) * - * \todo H5Pget_filter1() prototype does not match source in H5Pocpl.c. - * Also, it is not in a deprecated file. Is that okay? + * * * \plist_id{plist_id} - * \param[in] filter Sequence number within the filter pipeline of the filter - * for which information is sought - * \param[out] flags Bit vector specifying certain general properties of - * the filter + * \param[in] filter Sequence number within the filter pipeline of + * the filter for which information is sought + * \param[out] flags Bit vector specifying certain general properties + * of the filter * \param[in,out] cd_nelmts Number of elements in \p cd_values - * \param[out] cd_values Auxiliary data for the filter - * \param[in] namelen Anticipated number of characters in \p name - * \param[out] name Name of the filter + * \param[out] cd_values Auxiliary data for the filter + * \param[in] namelen Anticipated number of characters in \p name + * \param[out] name Name of the filter * * \return Returns the filter identifier if successful; Otherwise returns * a negative value. See: #H5Z_filter_t * + * \deprecated When was this function deprecated? + * * \details H5Pget_filter1() returns information about a filter, specified * by its filter number, in a filter pipeline, specified by the * property list with which it is associated. @@ -1359,13 +9609,127 @@ H5_DLL herr_t H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc); H5_DLL H5Z_filter_t H5Pget_filter1(hid_t plist_id, unsigned filter, unsigned int *flags /*out*/, size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, char name[]); -H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, - size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, - char name[] /*out*/); -H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/, - unsigned *stab /*out*/, unsigned *shhdr /*out*/); -H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold); -H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold); +/** + * \ingroup DCPL + * + * \brief Returns information about the specified filter + * + * \plist_id{plist_id} + * \param[in] id Filter identifier + * \param[out] flags Bit vector specifying certain general properties + * of the filter + * \param[in,out] cd_nelmts Number of elements in \p cd_values + * \param[out] cd_values Auxiliary data for the filter + * \param[in] namelen Anticipated number of characters in \p name + * \param[out] name Name of the filter + * + * + * \return Returns a non-negative value if successful; Otherwise returns + * a negative value. + * + * \deprecated As of HDF5-1.8 this function was deprecated in favor of + * H5Pget_filter_by_id2() or the macro H5Pget_filter_by_id(). + * + * \details H5Pget_filter_by_id1() returns information about a filter, specified + * in \p id, a filter identifier. + * + * \p plist_id must be a dataset or group creation property list and + * \p id must be in the associated filter pipeline. + * + * The \p id and \p flags parameters are used in the same + * manner as described in the discussion of H5Pset_filter(). + * + * Aside from the fact that they are used for output, the parameters + * \p cd_nelmts and \p cd_values[] are used in the same manner as + * described in the discussion of H5Pset_filter(). + * On input, the \p cd_nelmts parameter indicates the number of entries + * in the \p cd_values[] array allocated by the calling program; + * on exit it contains the number of values defined by the filter. + * + * On input, the \p namelen parameter indicates the number of + * characters allocated for the filter name by the calling program + * in the array \p name[]. On exit \p name[] contains the name of the + * filter with one character of the name in each element of the array. + * + * If the filter specified in \p id is not set for the property + * list, an error will be returned and this function will fail. + * + * + * \version 1.8.5 Function extended to work with group creation property + * lists. + * \version 1.8.0 Function H5Pget_filter_by_id() renamed to + * H5Pget_filter_by_id1() and deprecated in this release. + * \version 1.6.0 Function introduced in this release. + */ +H5_DLL herr_t H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*/, + size_t *cd_nelmts /*out*/, unsigned cd_values[] /*out*/, size_t namelen, + char name[] /*out*/); +/** + * \ingroup FCPL + * + * \brief Retrieves the version information of various objects + * for a file creation property list(deprecated) + * + * \plist_id + * \param[out] boot Pointer to location to return super block version number + * \param[out] freelist Pointer to location to return global freelist version number + * \param[out] stab Pointer to location to return symbol table version number + * \param[out] shhdr Pointer to location to return shared object header version + * number + * + * \return \herr_t + * + * \deprecated Deprecated in favor of the function H5Fget_info() + * + * \details H5Pget_version() retrieves the version information of various objects + * for a file creation property list. Any pointer parameters which are + * passed as NULL are not queried. + * + * \version 1.6.4 \p boot, \p freelist, \p stab, \p shhdr parameter types + * changed to unsigned. + * + */ +H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot /*out*/, unsigned *freelist /*out*/, + unsigned *stab /*out*/, unsigned *shhdr /*out*/); +/** + * \ingroup FCPL + * + * \brief Sets the file space handling strategy and the free-space section + * size threshold. + * + * \fcpl_id{plist_id} + * \param[in] strategy The file space handling strategy to be used. See: + * #H5F_fspace_strategy_t + * \param[in] threshold The smallest free-space section size that the free + * space manager will track + * + * \return \herr_t + * + * \deprecated When was this function deprecated? + * + * \details Maps to the function H5Pset_file_space_strategy(). + * + */ +H5_DLL herr_t H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t threshold); +/** + * \ingroup FCPL + * + * \brief Retrieves the file space handling strategy, and threshold value for + * a file creation property list + * + * \fcpl_id{plist_id} + * \param[out] strategy Pointer to the file space handling strategy + * \param[out] threshold Pointer to the free-space section size threshold value + * + * \return \herr_t + * + * \deprecated When was this function deprecated? + * + * \details Maps to the function H5Pget_file_space_strategy() + * + * + */ +H5_DLL herr_t H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy, hsize_t *threshold); #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h index 9a3bf33..2a34d56 100644 --- a/src/H5Rmodule.h +++ b/src/H5Rmodule.h @@ -25,4 +25,11 @@ #define H5_MY_PKG_ERR H5E_REFERENCE #define H5_MY_PKG_INIT YES +/** + * \defgroup H5R H5R + * \brief Reference Interface + * \details The HDF5 Reference Interface, H5R, provides a mechanism for managing + * HDF5 referenced objects. + */ + #endif /* H5Rmodule_H */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 4a82119..e26a72c 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -40,40 +40,54 @@ /* Public Typedefs */ /*******************/ -/* +//! <!-- [H5R_type_t_snip] --> +/** * Reference types allowed. - * DO NOT CHANGE THE ORDER or VALUES as reference type values are encoded into - * the datatype message header. + * + * \internal DO NOT CHANGE THE ORDER or VALUES as reference type values are + * encoded into the datatype message header. */ typedef enum { - H5R_BADTYPE = (-1), /* Invalid reference type */ - H5R_OBJECT1 = 0, /* Backward compatibility (object) */ - H5R_DATASET_REGION1 = 1, /* Backward compatibility (region) */ - H5R_OBJECT2 = 2, /* Object reference */ - H5R_DATASET_REGION2 = 3, /* Region reference */ - H5R_ATTR = 4, /* Attribute Reference */ - H5R_MAXTYPE = 5 /* Highest type (invalid) */ + H5R_BADTYPE = (-1), /**< Invalid reference type */ + H5R_OBJECT1 = 0, /**< Backward compatibility (object) */ + H5R_DATASET_REGION1 = 1, /**< Backward compatibility (region) */ + H5R_OBJECT2 = 2, /**< Object reference */ + H5R_DATASET_REGION2 = 3, /**< Region reference */ + H5R_ATTR = 4, /**< Attribute Reference */ + H5R_MAXTYPE = 5 /**< Highest type (invalid) */ } H5R_type_t; +//! <!-- [H5R_type_t_snip] --> /* Deprecated types are kept for backward compatibility with previous versions */ +//! <!-- [hobj_ref_t_snip] --> /** - * Deprecated object reference type that is used with deprecated reference APIs. - * Note! This type can only be used with the "native" HDF5 VOL connector. + * \deprecated Deprecated object reference type that is used with deprecated + * reference APIs. + * + * \note This type can only be used with the "native" HDF5 VOL connector. */ typedef haddr_t hobj_ref_t; +//! <!-- [hobj_ref_t_snip] --> +//! <!-- [hdset_reg_ref_t_snip] --> /** - * Dataset region reference type that is used with deprecated reference APIs. - * (Buffer to store heap ID and index) - * This needs to be large enough to store largest haddr_t in a worst case + * Buffer to store heap ID and index + * + * This needs to be large enough to store largest #haddr_t in a worst case * machine (8 bytes currently) plus an int. - * Note! This type can only be used with the "native" HDF5 VOL connector. + * + * \deprecated Dataset region reference type that is used with deprecated + * reference APIs. + * + * \note This type can only be used with the "native" HDF5 VOL connector. */ typedef struct { uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE]; } hdset_reg_ref_t; +//! <!-- [hdset_reg_ref_t_snip] --> +//! <!-- [H5R_ref_t_snip] --> /** * Opaque reference type. The same reference type is used for object, * dataset region and attribute references. This is the type that @@ -81,10 +95,11 @@ typedef struct { */ typedef struct { union { - uint8_t __data[H5R_REF_BUF_SIZE]; /* opaque data */ - int64_t align; /* ensures alignment */ + uint8_t __data[H5R_REF_BUF_SIZE]; /**< opaque data */ + int64_t align; /**< ensures alignment */ } u; } H5R_ref_t; +//! <!-- [H5R_ref_t_snip] --> /********************/ /* Public Variables */ @@ -99,30 +114,427 @@ extern "C" { #endif /* Constructors */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Creates an object reference + * + * \fgdta_loc_id + * \param[in] name Name of object + * \oapl_id + * \param[out] ref_ptr Pointer to reference + * + * \return \herr_t + * + * \details H5Rcreate_object() creates a reference pointing to the + * object named \p name located at \p loc_id. The parameters \p + * loc_id and \p name are used to locate the object. + * + * The parameter \p oapl_id is an object access property list + * identifier for the referenced object. The access property list + * must be of the same type as the object being referenced, that is + * a group, dataset or committed datatype property list. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + * H5Rdestroy() should be used to release the resource from the + * reference. + * + */ H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Creates a region reference + * + * \fgdta_loc_id + * \param[in] name Name of object + * \space_id + * \oapl_id + * \param[out] ref_ptr Pointer to reference + * + * \return \herr_t + * + * \details H5Rcreate_region() creates the reference, \p ref_ptr, + * pointing to the region represented by \p space_id within the + * object named name located at \p loc_id. + * + * The parameters \p loc_id and \p name are used to locate the + * object. The parameter \p space_id identifies the dataset region + * that a dataset region reference points to. + * + * The parameter \p oapl_id is an object access property list + * identifier for the referenced object. The access property list + * must be of the same type as the object being referenced, that is + * a dataset property list in this case. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + * H5Rdestroy() should be used to release the resource from the + * reference. + * + */ H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Creates an attribute reference + * + * \fgdta_loc_id + * \param[in] name Name of object + * \param[in] attr_name Name of attribute + * \oapl_id + * \param[out] ref_ptr Pointer to reference + * + * \return \herr_t + * + * \details H5Rcreate_attr() creates the reference, \p ref_ptr, pointing + * to the attribute named \p attr_name and attached to the object + * named \p name located at \p loc_id. + * + * The parameters \p loc_id and \p name locate the object. The + * parameter \p attr_name specifies the attribute within the object. + * + * The parameter \p oapl_id is an object access property list + * identifier for the object that the referenced attribute is + * attached to. The access property list must be of the same type + * as that object, that is a group, dataset or committed datatype + * property list. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + * H5Rdestroy() should be used to release the resource from the + * reference. + * + */ H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Closes a reference + * + * \param[in] ref_ptr Pointer to reference + * + * \return \herr_t + * + * \details Given a reference, \p ref_ptr, to an object, region or attribute + * attached to an object, H5Rdestroy() releases allocated resources + * from a previous create call. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + */ H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); /* Info */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the type of a reference + * + * \param[in] ref_ptr Pointer to reference + * + * \return Returns a valid reference type if successful; otherwise returns #H5R_BADTYPE . + * + * \details Given a reference, \p ref_ptr, H5Rget_type() returns the + * type of the reference. + * + * Valid returned reference types are: + * \snippet this H5R_type_t_snip + * + * Note that #H5R_OBJECT1 and #H5R_DATASET_REGION1 can never be + * associated to an \ref H5R_ref_t reference and can therefore never be + * returned through that function. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + */ H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr); -H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr); -H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Determines whether two references are equal + * + * \param[in] ref1_ptr Pointer to reference to compare + * \param[in] ref2_ptr Pointer to reference to compare + * + * \return Returns a positive value if the references are equal. Returns + * 0 if the references are not equal. Returns a negative value when the + * function fails. + * + * \details H5Requal() determines whether two references point to the + * same object, region or attribute. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + */ +H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Copies an existing reference + * + * \param[in] src_ref_ptr Pointer to reference to copy + * \param[out] dst_ref_ptr Pointer to output reference + * + * \return \herr_t + * + * \details H5Rcopy() creates a copy of an existing reference. + * \p src_ref_ptr points to the reference to copy and \p dst_ref_ptr is the + * pointer to the destination reference. + * + */ +H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr); /* Dereference */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Opens the HDF5 object referenced + * + * \param[in] ref_ptr Pointer to reference to open + * \rapl_id + * \oapl_id + * + * \return \hid_t{object} + * + * \details Given a reference, \p ref_ptr, to an object, a region in + * an object, or an attribute attached to an object, H5Ropen_object() + * opens that object and returns an identifier. + * + * The parameter \p oapl_id is an object access property list + * identifier for the referenced object. The access property list + * must be of the same type as the object being referenced, that is + * a group or dataset property list. + * + * \ref H5R_ref_t is defined in H5Rpublic.h as: + * \snippet this H5R_ref_t_snip + * + * The object opened with this function should be closed when it + * is no longer needed so that resource leaks will not develop. Use + * the appropriate close function such as H5Oclose() or H5Dclose() + * for datasets. + * + */ H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Sets up a dataspace and selection as specified by a region reference. + * + * \param[in] ref_ptr Pointer to reference to open + * \rapl_id + * \oapl_id + * + * \return \hid_t{dataspace} + * + * \details H5Ropen_region() creates a copy of the dataspace of the + * dataset pointed to by a region reference, \p ref_ptr, and defines + * a selection matching the selection pointed to by \p ref_ptr within + * the dataspace copy. + * + * The parameter \p rapl id is a reference access property list + * identifier for the reference. The access property list can + * be used to access external files that the reference points to + * (through a file access property list). + * + * The parameter \p oapl id is an object access property list + * identifier for the referenced object. The access property list + * must be of the same type as the object being referenced, that is + * a dataset property list in that case. + * + * Use H5Sclose() to release the dataspace identifier returned by + * this function when the identifier is no longer needed. + * + */ H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Opens the HDF5 attribute referenced + * + * \param[in] ref_ptr Pointer to reference to open + * \rapl_id + * \aapl_id + * + * \return \hid_t{attribute} + * + * \details Given a reference, \p ref_ptr, to an attribute attached to + * an object, H5Ropen_attr() opens the attribute attached to that + * object and returns an identifier. + * + * The parameter \p rapl id is a reference access property list + * identifier for the reference. The access property list can + * be used to access external files that the reference points to + * (through a file access property list). + * + * The parameter \p aapl_id is an attribute access property list + * identifier for the referenced attribute. + * + * The attribute opened with this function should be closed with + * H5Aclose() when it is no longer needed. + * + */ H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); /* Get type */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the type of object that an object reference points to + * + * \param[in] ref_ptr Pointer to reference to query + * \rapl_id + * \param[out] obj_type Type of referenced object + * + * \return \herr_t + * + * \details Given a reference, \p ref_ptr, H5Rget_obj_type3() retrieves + * the type of the referenced object in \p obj_type. + * + * The parameter \p rapl id is a reference access property list + * identifier for the reference. The access property list can + * be used to access external files that the reference points to + * (through a file access property list). + * + * Upon success, the function returns in \p obj_type the type of + * the object that the reference points to. Valid values for this + * referenced object type are as followed (defined in H5Opublic.h): + * \snippet H5Opublic.h H5O_type_t_snip + * + */ H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type); /* Get name */ -H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf, size_t size); -H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size); -H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the file name for a referenced object + * + * \param[in] ref_ptr Pointer to reference to query + * \param[in,out] name Buffer to place the file name of the reference + * \param[in] size Size of the \p name buffer + * + * \return Returns the length of the name if successful, otherwise, a negative value. + * + * \details H5Rget_file_name() retrieves the file name for the object, + * region or attribute reference pointed to by \p ref_ptr. + * + * Up to \p size characters of the name are returned in \p name; + * additional characters, if any, are not returned to the user + * application. If the length of the name, which determines + * the required value of size, is unknown, a preliminary + * H5Rget_file_name() call can be made. The return value of this + * call will be the size of the file name. That value can then be + * passed in for size in the second call to H5Rget_file_name(), + * which will retrieve the actual name. + * + */ +H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the object name for a referenced object + * + * \param[in] ref_ptr Pointer to reference to query + * \rapl_id + * \param[in,out] name Buffer to place the file name of the reference + * \param[in] size Size of the \p name buffer + * + * \return Returns the length of the name if successful, returning + * 0 (zero) if no name is associated with the identifier. Otherwise + * returns a negative value. + * + * \details H5Rget_obj_name() retrieves the object name for the object, + * region or attribute reference pointed to by \p ref_ptr. + * + * The parameter \p rapl_id is a reference access property list + * identifier for the reference. The access property list can + * be used to access external files that the reference points to + * (through a file access property list). + * + * Up to size characters of the name are returned in \p name; additional + * characters, if any, are not returned to the user application. If + * the length of the name, which determines the required value of + * \p size, is unknown, a preliminary call to H5Rget_obj_name() call + * can be made. The return value of this call will be the size of the + * object name. That value can then be passed in for \p size in the + * second call to H5Rget_obj_name(), which will retrieve the actual + * name. If there is no name associated with the object identifier + * or if the name is NULL, H5Rget_obj_name() returns the size of + * the name buffer (the size does not include the \c \0 terminator). + * + * If \p ref_ptr is an object reference, \p name will be returned with + * a name for the referenced object. If \p ref_ptr is a dataset region + * reference, \p name will contain a name for the object containing + * the referenced region. If \p ref_ptr is an attribute reference, \p + * name will contain a name for the object the attribute is attached + * to. Note that an object in an HDF5 file may have multiple paths + * if there are multiple links pointing to it. This function may + * return any one of these paths. + * + */ +H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *name, size_t size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the attribute name for a referenced object + * + * \param[in] ref_ptr Pointer to reference to query + * \param[in,out] name Buffer to place the attribute name of the reference + * \param[in] size Size of the \p name buffer + * + * \return Returns the length of the name if successful, otherwise, a negative value. + * + * \details H5Rget_attr_name() retrieves the attribute name for the + * attribute reference pointed to by \p ref_ptr. + * + * Up to size characters of the name are returned in \p name; + * additional characters, if any, are not returned to the user + * application. If the length of the name, which determines + * the required value of \p size, is unknown, a preliminary + * H5Rget_attr_name() call can be made. The return value of this + * call will be the size of the attribute name. That value can then + * be passed in for size in the second call to H5Rget_attr_name(), + * which will retrieve the actual name. + * + */ +H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t size); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -138,15 +550,334 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf, size_t size /* Function prototypes */ #ifndef H5_NO_DEPRECATED_SYMBOLS +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the type of object that an object reference points to + * + * \param[in] id The dataset containing the reference object or the group + * containing that dataset + * \param[in] ref_type Type of reference to query + * \param[in] ref Reference to query + * + * \return Returns a valid object type if successful; otherwise returns a + * negative value (#H5G_UNKNOWN). + * + * \deprecated This function has been renamed from H5Rget_obj_type() and is + * deprecated in favor of the macro H5Rget_obj_type() or the + * function H5Rget_obj_type2(). + * + * \details Given an object reference, \p ref, H5Rget_obj_type1() returns the + * type of the referenced object. + * + * A \Emph{reference type} is the type of reference, either an object + * reference or a dataset region reference. An \Emph{object reference} + * points to an HDF5 object while a \Emph{dataset region reference} + * points to a defined region within a dataset. + * + * The \Emph{referenced object} is the object the reference points + * to. The \Emph{referenced object type}, or the type of the referenced + * object, is the type of the object that the reference points to. + * + * The location identifier, \p id, is the identifier for either the + * dataset containing the object reference or the group containing that + * dataset. + * + * Valid reference types, to pass in as \p ref_type, include the + * following: + * \snippet this H5R_type_t_snip + * + * If the application does not already know the object reference type, + * that can be determined with three preliminary calls: + * + * \li Call H5Dget_type() on the dataset containing the reference to + * get a datatype identifier for the dataset’s datatype. + * \li Using that datatype identifier, H5Tget_class() returns a datatype + * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can + * then be used to determine whether the reference’s datatype is + * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG: + * - If the datatype is #H5T_STD_REF_OBJ, the reference object type + * is #H5R_OBJECT. + * - If the datatype is #H5T_STD_REF_DSETREG, the reference object + * type is #H5R_DATASET_REGION. + * + * When the function completes successfully, it returns one of the + * following valid object type values (defined in H5Gpublic.h): + * \snippet H5Gpublic.h H5G_obj_t_snip + * + * \version 1.8.0 Function H5Rget_obj_type() renamed to H5Rget_obj_type1() and + * deprecated in this release. + * \since 1.6.0 + * + */ H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref); -H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Opens the HDF5 object referenced + * + * \obj_id + * \param[in] ref_type The reference type of \p ref + * \param[in] ref Reference to open + * + * \return Returns identifier of referenced object if successful; otherwise + * returns a negative value. + * + * \deprecated This function has been renamed from H5Rdereference() and is + * deprecated in favor of the macro H5Rdereference() or the function + * H5Rdereference2(). + * + * \details Given a reference, \p ref, to an object or a region in an object, + * H5Rdereference1() opens that object and returns an identifier. + * + * The parameter \p obj_id must be a valid identifier for an object in + * the HDF5 file containing the referenced object, including the file + * identifier. + * + * The parameter \p ref_type specifies the reference type of the + * reference \p ref. \p ref_type may contain either of the following + * values: + * - #H5R_OBJECT + * - #H5R_DATASET_REGION + * + * The object opened with this function should be closed when it is no + * longer needed so that resource leaks will not develop. Use the + * appropriate close function such as H5Oclose() or H5Dclose() for + * datasets. + * + * \version 1.10.0 Function H5Rdereference() renamed to H5Rdereference1() and + * deprecated in this release. + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id); -H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type); -H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref); -H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref); +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Creates a reference + * + * \param[out] ref Reference created by the function call + * \param[in] loc_id Location identifier used to locate the object being pointed to + * \param[in] name Name of object at location \p loc_id + * \param[in] ref_type Type of reference + * \param[in] space_id Dataspace identifier with selection. Used only for + * dataset region references; pass as -1 if reference is + * an object reference, i.e., of type #H5R_OBJECT + * + * \return \herr_t + * + * \details H5Rcreate() creates the reference, \p ref, of the type specified in + * \p ref_type, pointing to the object \p name located at \p loc_id. + * + * The HDF5 library maps the void type specified above for \p ref to + * the type specified in \p ref_type, which will be one of the following: + * \snippet this H5R_type_t_snip + * + * The parameters \p loc_id and \p name are used to locate the object. + * + * The parameter \p space_id identifies the dataset region that a + * dataset region reference points to. This parameter is used only with + * dataset region references and should be set to -1 if the reference + * is an object reference, #H5R_OBJECT. + * + * \since 1.8.0 + */ +H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves the type of object that an object reference points to + * + * \param[in] id The dataset containing the reference object or the group + * containing that dataset + * \param[in] ref_type Type of reference to query + * \param[in] ref Reference to query + * \param[out] obj_type Type of referenced object + * + * \return \herr_t + * + * \details Given an object reference, \p ref, H5Rget_obj_type2() returns the + * type of the referenced object in \p obj_type. + * + * A \Emph{reference type} is the type of reference, either an object + * reference or a dataset region reference. An \Emph{object reference} + * points to an HDF5 object while a \Emph{dataset region reference} + * points to a defined region within a dataset. + * + * The \Emph{referenced object} is the object the reference points + * to. The \Emph{referenced object type}, or the type of the referenced + * object, is the type of the object that the reference points to. + * + * The location identifier, \p id, is the identifier for either the + * dataset containing the object reference or the group containing that + * dataset. + * + * Valid reference types, to pass in as \p ref_type, include the + * following: + * \snippet this H5R_type_t_snip + * + * If the application does not already know the object reference type, + * that can be determined with three preliminary calls: + * + * \li Call H5Dget_type() on the dataset containing the reference to + * get a datatype identifier for the dataset’s datatype. + * \li Using that datatype identifier, H5Tget_class() returns a datatype + * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can + * then be used to determine whether the reference’s datatype is + * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG: + * - If the datatype is #H5T_STD_REF_OBJ, the reference object type + * is #H5R_OBJECT. + * - If the datatype is #H5T_STD_REF_DSETREG, the reference object + * type is #H5R_DATASET_REGION. + * + * When the function completes successfully, it returns one of the + * following valid object type values (defined in H5Opublic.h): + * \snippet H5Opublic.h H5O_type_t_snip + * + * \since 1.8.0 + * + */ +H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Opens the HDF5 object referenced + * + * \obj_id + * \oapl_id + * \param[in] ref_type The reference type of \p ref + * \param[in] ref Reference to open + * + * \return Returns identifier of referenced object if successful; otherwise + * returns a negative value. + * + * \details Given a reference, \p ref, to an object or a region in an object, + * H5Rdereference2() opens that object and returns an identifier. + * + * The parameter \p obj_id must be a valid identifier for the HDF5 file + * containing the referenced object or for any object in that HDF5 + * file. + * + * The parameter \p oapl_id is an object access property list + * identifier for the referenced object. The access property list must + * be of the same type as the object being referenced, that is a group, + * dataset, or datatype property list. + * + * The parameter \p ref_type specifies the reference type of the + * reference \p ref. \p ref_type may contain either of the following + * values: + * - #H5R_OBJECT + * - #H5R_DATASET_REGION + * + * The object opened with this function should be closed when it is no + * longer needed so that resource leaks will not develop. Use the + * appropriate close function such as H5Oclose() or H5Dclose() for + * datasets. + * + * \since 1.10.0 + * + */ +H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Sets up a dataspace and selection as specified by a region reference + * + * \param[in] dataset File identifier or identifier for any object in the file + * containing the referenced region + * \param[in] ref_type Reference type of \p ref, which must be #H5R_DATASET_REGION + * \param[in] ref Region reference to open + * + * \return Returns a valid dataspace identifier if successful; otherwise returns + * a negative value. + * + * \details H5Rget_region() creates a copy of the dataspace of the dataset + * pointed to by a region reference, \p ref, and defines a selection + * matching the selection pointed to by ref within the dataspace copy. + * + * \p dataset is used to identify the file containing the referenced + * region; it can be a file identifier or an identifier for any object + * in the file. + * + * The parameter \p ref_type specifies the reference type of \p ref and + * must contain the value #H5R_DATASET_REGION. + * + * Use H5Sclose() to release the dataspace identifier returned by this + * function when the identifier is no longer needed. + * + */ +H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5R + * + * \brief Retrieves a name for a referenced object + * + * \param[in] loc_id Identifier for the file containing the reference or for + * any object in that file + * \param[in] ref_type Type of reference + * \param[in] ref An object or dataset region reference + * \param[out] name A buffer to place the name of the referenced object or + * dataset region. If \c NULL, then this call will return the + * size in bytes of the name. + * \param[in] size The size of the \p name buffer. When the size is passed in, + * the \c NULL terminator needs to be included. + * + * \return Returns the length of the name if successful, returning 0 (zero) if + * no name is associated with the identifier. Otherwise returns a + * negative value. + * + * \details H5Rget_name() retrieves a name for the object identified by \p ref.\n + * \p loc_id is used to identify the file containing the reference. It + * can be the file identifier for the file containing the reference or + * an identifier for any object in that file. + * + * \ref H5R_type_t is the reference type of \p ref. Valid values + * include the following: + * \snippet this H5R_type_t_snip + * + * \p ref is the reference for which the target object’s name is + * sought. + * + * If \p ref is an object reference, \p name will be returned with a + * name for the referenced object. If \p ref is a dataset region + * reference, \p name will contain a name for the object containing the + * referenced region. + * + * Up to \p size characters of the name are returned in \p name; + * additional characters, if any, are not returned to the user + * application. + * + * If the length of the name, which determines the required value of \p + * size, is unknown, a preliminary H5Rget_name() call can be made. The + * return value of this call will be the size of the object name. That + * value can then be assigned to \p size for a second H5Rget_name() + * call, which will retrieve the actual name. + * + * If there is no name associated with the object identifier or if the + * \p name is \c NULL, H5Rget_name() returns the size of the \p name + * buffer (the size does not include the \p NULL terminator). + * + * Note that an object in an HDF5 file may have multiple paths if there + * are multiple links pointing to it. This function may return any one + * of these paths. + * + * \since 1.8.0 + */ H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name, size_t size); #ifdef __cplusplus diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 9888f56..fd85dcc 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -120,7 +120,7 @@ typedef enum { extern "C" { #endif -/* Operations on dataspaces and dataspace selections */ +/* Operations on dataspaces, dataspace selections and selection iterators */ /** * \ingroup H5S @@ -143,6 +143,76 @@ H5_DLL herr_t H5Sclose(hid_t space_id); /** * \ingroup H5S * + * \brief Performs an operation on a hyperslab and an existing selection and + * returns the resulting selection + * + * \space_id + * \param[in] op Operation to perform on the current selection + * \param[in] start Offset of the start of of the hyperslab + * \param[in] stride Hyperslab stride + * \param[in] count Number of blocks included in the hyperslab + * \param[in] block Size of a block in the hyperslab + * + * \return \hid_tv{dataspace} + * + * \details H5Scombine_hyperslab() combines a hyperslab selection specified + * by \p start, \p stride, \p count and \p block with the current + * selection for the dataspace \p space_id, creating a new dataspace + * to return the generated selection. If the current selection is + * not a hyperslab, it is freed and the hyperslab parameters passed + * in are combined with the #H5S_SEL_ALL hyperslab (ie. a selection + * composing the entire current extent). If either \p stride or + * \p block is NULL, then it will be set to \p 1. + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], + const hsize_t stride[], const hsize_t count[], const hsize_t block[]); +/** + * \ingroup H5S + * + * \brief Combine two hyperslab selections with an operation, returning a + * dataspace with the resulting selection + * + * \space_id{space1_id} + * \param[in] op Selection operator + * \space_id{space2_id} + * + * \return \hid_t{dataspace} + * + * \details H5Scombine_select() combines two hyperslab selections + * \p space1_id and \p space2_id with an operation, returning a + * new dataspace with the resulting selection. The dataspace extent + * from \p space1_id is copied for the dataspace extent of the + * newly created dataspace. + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id); +/** + * \ingroup H5S + * + * \brief Creates an exact copy of a dataspace + * + * \space_id + * + * \return \hid_tv{dataspace} + * + * \details H5Scopy() creates a new dataspace which is an exact copy of the + * dataspace identified by \p space_id. The dataspace identifier + * returned from this function should be released with H5Sclose() + * or resource leaks will occur. + * + * \version 1.4.0 Fortran subroutine introduced. + * \since 1.0.0 + * + */ +H5_DLL hid_t H5Scopy(hid_t space_id); +/** + * \ingroup H5S + * * \brief Creates a new dataspace of a specified type * * \param[in] type Type of dataspace to be created @@ -182,32 +252,34 @@ H5_DLL hid_t H5Screate(H5S_class_t type); * * \return \hid_t{dataspace} * - * \details H5Screate_simple() creates a new simple dataspace and opens it - * for access, returning a dataspace identifier. + * \details H5Screate_simple() creates a new simple dataspace and opens it + * for access, returning a dataspace identifier. * - * \p rank is the number of dimensions used in the dataspace. + * \p rank is the number of dimensions used in the dataspace. * - * \p dims is a one-dimensional array of size rank specifying the - * size of each dimension of the dataset. \p maxdims is an array of the - * same size specifying the upper limit on the size of each dimension. + * \p dims is a one-dimensional array of size rank specifying the + * size of each dimension of the dataset. \p maxdims is an array of + * the same size specifying the upper limit on the size of each + * dimension. * - * Any element of \p dims can be \p 0 (zero). Note that no data can - * be written to a dataset if the size of any dimension of its current - * dataspace is \p 0. This is sometimes a useful initial state for a dataset. + * Any element of \p dims can be \p 0 (zero). Note that no data can + * be written to a dataset if the size of any dimension of its current + * dataspace is \p 0. This is sometimes a useful initial state for + * a dataset. * - * \p maxdims may be the null pointer, in which case the upper limit is - * the same as \p dims. Otherwise, no element of \p maxdims - * should be smaller than the corresponding element of \p dims. + * \p maxdims may be the null pointer, in which case the upper limit + * is the same as \p dims. Otherwise, no element of \p maxdims + * should be smaller than the corresponding element of \p dims. * - * If an element of \p maxdims is #H5S_UNLIMITED, the maximum size of the - * corresponding dimension is unlimited. + * If an element of \p maxdims is #H5S_UNLIMITED, the maximum size of + * the corresponding dimension is unlimited. * - * Any dataset with an unlimited dimension must also be chunked; see - * H5Pset_chunk(). Similarly, a dataset must be chunked if \p dims does - * not equal \p maxdims. + * Any dataset with an unlimited dimension must also be chunked; see + * H5Pset_chunk(). Similarly, a dataset must be chunked if \p dims + * does not equal \p maxdims. * - * The dataspace identifier returned from this function must be released with - * H5Sclose() or resource leaks will occur. + * The dataspace identifier returned from this function must be + * released with H5Sclose() or resource leaks will occur. * * \note Once a dataspace has been created, specific regions or elements in * the dataspace can be selected and selections can be removed, as well. @@ -223,8 +295,301 @@ H5_DLL hid_t H5Screate(H5S_class_t type); * */ H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxdims[]); -/*--------------------------------------------------------------------------*/ -/**\ingroup H5S +/** + * \ingroup H5S + * + * \brief Decodes a binary object description of data space and returns a + * new object handle + * + * \param[in] buf Buffer for the data space object to be decoded + * + * \return \hid_t{dataspace} + * + * \details Given an object description of a dataspace in binary in a + * buffer, H5Sdecode() reconstructs the HDF5 data type object and + * returns a new object handle for it. The binary description of the + * object is encoded by H5Sencode(). The user is responsible for + * passing in the right buffer. The types of dataspace addressed + * in this function are null, scalar, and simple space. For a + * simple dataspace, the selection information (for example, + * hyperslab selection) is also encoded and decoded. A complex + * dataspace has not been implemented in the library. + * + * \since 1.8.0 + * + */ +H5_DLL hid_t H5Sdecode(const void *buf); +/** + * \ingroup H5S + * + * \brief Encodes a data space object description into a binary buffer + * + * \space_id{obj_id} + * \param[in,out] buf Buffer for the object to be encoded into; + * If the provided buffer is NULL, only the size + * of buffer needed is returned through \p nalloc. + * \param[in,out] nalloc The size of the allocated buffer + * \fapl_id{fapl} + * + * \return \herr_t + * + * \details Given the data space identifier \p obj_id, H5Sencode2() converts + * a data space description into binary form in a buffer. Using this + * binary form in the buffer, a data space object can be + * reconstructed with H5Sdecode() to return a new object handle + * (#hid_t) for this data space. + * + * A preliminary H5Sencode2() call can be made to determine the + * size of the buffer needed. This value is returned in \p nalloc. + * That value can then be assigned to \p nalloc for a second + * H5Sencode2() call, which will retrieve the actual encoded object. + * + * If the library determines that \p nalloc is not big enough for the + * object, it simply returns the size of the buffer needed through + * \p nalloc without encoding the provided buffer. + * + * The file access property list \p fapl_id is used to control the + * encoding via the \a libver_bounds property (see + * H5Pset_libver_bounds()). If the \a libver_bounds property is missing, + * H5Sencode2() proceeds as if the \a libver_bounds property were set to + * (#H5F_LIBVER_EARLIEST, #H5F_LIBVER_LATEST). (Functionally, + * H5Sencode1() is identical to H5Sencode2() with \a libver_bounds set to + * (#H5F_LIBVER_EARLIEST, #H5F_LIBVER_LATEST).) + * + * The types of data space that are addressed in this function are + * null, scalar, and simple space. For a simple data space, the + * information on the selection, for example, hyperslab selection, + * is also encoded and decoded. A complex data space has not been + * implemented in the library. + * + * \note Motivation: This function was introduced in HDF5-1.12 as part of the + * H5Sencode() format change to enable 64-bit selection encodings and + * a dataspace selection that is tied to a file. See the \ref_news_112 + * as well as the \ref_sencode_fmt_change. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl); +/** + * \ingroup H5S + * + * \brief Copies the extent of a dataspace + * + * \space_id{dst_id} + * \space_id{src_id} + * + * \return \herr_t + * + * \details H5Sextent_copy() copies the extent from \p src_id to \p dst_id. + * This action may change the type of the dataspace. + * + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Sextent_copy(hid_t dst_id, hid_t src_id); +/** + * \ingroup H5S + * + * \brief Determines whether two dataspace extents are equal + * + * \space_id{space1_id} + * \space_id{space2_id} + * + * \return \htri_t + * + * \details H5Sextent_equal() determines whether the dataspace extents of + * two dataspaces, \p space1_id and \p space2_id, are equal. + * + * \since 1.8.0 + * + */ +H5_DLL htri_t H5Sextent_equal(hid_t space1_id, hid_t space2_id); +/** + * \ingroup H5S + * + * \brief Retrieves a regular hyperslab selection + * + * \space_id{spaceid} + * \param[out] start Offset of the start of the regular hyperslab + * \param[out] stride Stride of the regular hyperslab + * \param[out] count Number of blocks in the regular hyperslab + * \param[out] block Size of a block in the regular hyperslab + * + * \return \herr_t + * + * \details H5Sget_regular_hyperslab() takes the dataspace identifier, + * \p spaceid, and retrieves the values of \p start, \p stride, + * \p count, and \p block for the regular hyperslab selection. + * + * A regular hyperslab selection is a hyperslab selection + * described by setting the \p offset, \p stride, \p count, and + * \p block parameters to the H5Sselect_hyperslab() call. If + * several calls to H5Sselect_hyperslab() are needed, the + * hyperslab selection is irregular. + * + * See H5Sselect_hyperslab() for descriptions of \p offset, + * \p stride, \p count, and \p block. + * + * \note If a hyperslab selection is originally regular, then becomes + * irregular through selection operations, and then becomes regular + * again, the final regular selection may be equivalent but not + * identical to the original regular selection. + * + * \since 1.10.0 + * + */ +H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[], + hsize_t block[]); +/** + * \ingroup H5S + * + * \brief Gets the bounding box containing the current selection + * + * \space_id{spaceid} + * \param[out] start Starting coordinates of the bounding box + * \param[out] end Ending coordinates of the bounding box, i.e., the + * coordinates of the diagonally opposite corner + * + * \return \herr_t + * + * \details H5Sget_select_bounds() retrieves the coordinates of the bounding + * box containing the current selection and places them into + * user-supplied buffers. + * + * The \p start and \p end buffers must be large enough to hold + * the dataspace rank number of coordinates. + * + * The bounding box exactly contains the selection. I.e., if a + * 2-dimensional element selection is currently defined as containing + * the points (4,5), (6,8), and (10,7), then the bounding box + * will be (4, 5), (10, 8). + * + * The bounding box calculation includes the current offset of the + * selection within the dataspace extent. + * + * Calling this function on a \a none selection will fail. + * + * \version 1.6.0 The \p start and \p end parameters have changed from type + * \p hsize_t * to \p hssize_t *. + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.2.0 + * + */ +H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]); +/** + * \ingroup H5S + * + * \brief Gets the number of element points in the current selection + * + * \space_id{spaceid} + * + * \return Returns the number of element points in the current dataspace + * selection if successful. Otherwise returns a negative value. + * + * \details H5Sget_select_elem_npoints() returns the number of element + * points in the current dataspace selection, so that the element + * points can be retrieved with H5Sget_select_elem_pointlist(). + * (This is similar to the way that H5Sget_select_hyper_nblocks() + * and H5Sget_select_hyper_blocklist() work with hyperslab + * selections.) + * + * Coincidentally, H5Sget_select_npoints() and + * H5Sget_select_elem_npoints() will always return the same value + * when an element selection is queried, but + * H5Sget_select_elem_npoints() does not work with other selection + * types. + * + * \since 1.2.0 + * + */ +H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid); +/** + * \ingroup H5S + * + * \brief Gets the list of element points currently selected + * + * \space_id{spaceid} + * \param[in] startpoint Element point to start with + * \param[in] numpoints Number of element points to get + * \param[out] buf List of element points selected + * + * \details H5Sget_select_elem_pointlist() returns the list of element + * points in the current dataspace selection \p space_id. Starting + * with the \p startpoint in the list of points, \p numpoints + * points are put into the user's buffer. If the user's buffer + * fills up before \p numpoints points are inserted, the buffer + * will contain only as many points as fit. + * + * The element point coordinates have the same dimensionality + * (rank) as the dataspace they are located within. The list of + * element points is formatted as follows:\n + * \<coordinate\>, followed by\n + * the next coordinate,\n + * etc.\n + * until all of the selected element points have been listed. + * + * The points are returned in the order they will be iterated + * through when the selection is read/written from/to disk. + * + * \since 1.2.0 + * + */ +H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, + hsize_t buf[/*numpoints*/]); +/** + * \ingroup H5S + * + * \brief Gets the list of hyperslab blocks currently selected + * + * \space_id{spaceid} + * \param[in] startblock Hyperslab block to start with + * \param[in] numblocks Number of hyperslab blocks to get + * \param[out] buf List of hyperslab blocks selected + * + * \return \herr_t + * + * \details H5Sget_select_hyper_blocklist() returns a list of the hyperslab + * blocks currently selected. Starting with the \p startblock-th block + * in the list of blocks, \p numblocks blocks are put into the + * user's buffer. If the user's buffer fills up before \p numblocks + * blocks are inserted, the buffer will contain only as many blocks + * as fit. + * + * The block coordinates have the same dimensionality (rank) as the + * dataspace they are located within. The list of blocks is + * formatted as follows:\n + * \<"start" coordinate\>, immediately followed by\n + * \<"opposite" corner coordinate\>, followed by\n + * the next "start" and "opposite" coordinates,\n + * etc. until all of the selected blocks have been listed.\n + * No guarantee of any order of the blocks is implied. + * + * \since 1.2.0 + * + */ +H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, + hsize_t buf[/*numblocks*/]); +/** + * \ingroup H5S + * + * \brief Get number of hyperslab blocks + * + * \space_id{spaceid} + * + * \return Returns the number of hyperslab blocks in the current dataspace + * selection if successful. Otherwise returns a negative value. + * + * \details H5Sget_select_hyper_nblocks() returns the number of hyperslab + * blocks in the current dataspace selection. + * + * \since 1.2.0 + * + */ +H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid); +/** + * \ingroup H5S * * \brief Determines the number of elements in a dataspace selection * @@ -243,8 +608,47 @@ H5_DLL hid_t H5Screate_simple(int rank, const hsize_t dims[], const hsize_t maxd * */ H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid); -/*-------------------------------------------------------------------------*/ -/**\ingroup H5S +/** + * \ingroup H5S + * + * \brief Determines the type of the dataspace selection + * + * \space_id{spaceid} + * + * \return Returns the dataspace selection type, a value of the enumerated + * datatype #H5S_sel_type, if successful. + * + * \details H5Sget_select_type() retrieves the type of dataspace selection + * currently defined for the dataspace \p space_id. Valid values + * for the dataspace selection type are: + * + * <table> + * <tr> + * <td>#H5S_SEL_NONE</td> + * <td>No selection is defined</td> + * </tr> + * <tr> + * <td>#H5S_SEL_POINTS</td> + * <td>A sequence of points is selected</td> + * </tr> + * <tr> + * <td>#H5S_SEL_HYPERSLABS</td> + * <td>A hyperslab or compound hyperslab is selected</td> + * </tr> + * <tr> + * <td>#H5S_SEL_ALL</td> + * <td>The entire dataset is selected</td> + * </tr> + * </table> + * + * Otherwise returns a negative value. + * + * \since 1.6.0 + * + */ +H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); +/** + * \ingroup H5S * * \brief Retrieves dataspace dimension size and maximum size * @@ -270,8 +674,8 @@ H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid); * */ H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[]); -/*-------------------------------------------------------------------------*/ -/**\ingroup H5S +/** + * \ingroup H5S * * \brief Determines the dimensionality of a dataspace * @@ -288,9 +692,390 @@ H5_DLL int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t max * */ H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id); -/*--------------------------------------------------------------------------*/ +/** + * \ingroup H5S + * + * \brief Determines the number of elements in a dataspace + * + * \space_id + * + * \return Returns the number of elements in the dataspace if successful; + * otherwise returns a negative value. + * + * \details H5Sget_simple_extent_npoints() determines the number of elements + * in a dataspace \p space_id. For example, a simple 3-dimensional + * dataspace with dimensions 2, 3, and 4 would have 24 elements. + * + * \version 1.4.0 Fortran subroutine introduced. + * \since 1.0.0 + * + */ +H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id); +/** + * \ingroup H5S + * + * \brief Determines the current class of a dataspace + * + * \space_id + * + * \return Returns a dataspace class name if successful; + * otherwise #H5S_NO_CLASS (-1). + * + * \details H5Sget_simple_extent_type() determines the current class of a + * dataspace \p space_id. + * + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.0.0 + * + */ +H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); +/** + * \ingroup H5S + * + * \brief Determines if a hyperslab selection is regular + * + * \space_id{spaceid} + * + * \return \htri_t + * + * \details H5Sis_regular_hyperslab() takes the dataspace identifier, + * \p spaceid, and queries the type of the hyperslab selection. + * + * A regular hyperslab selection is a hyperslab selection described + * by setting the offset, stride, count, and block parameters for + * a single H5Sselect_hyperslab() call. If several calls to + * H5Sselect_hyperslab() are needed, then the hyperslab selection + * is irregular. + * + * \since 1.10.0 + * + */ +H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid); +/** + * \ingroup H5S + * + * \brief Determines whether a dataspace is a simple dataspace + * + * \space_id + * + * \return \htri_t + * + * \details H5Sis_simple() determines whether or not a dataspace is a simple + * dataspace. + * + * \note Currently, all dataspace objects are simple dataspaces; complex + * dataspace support will be added in the future. + * + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.0.0 + * + */ +H5_DLL htri_t H5Sis_simple(hid_t space_id); +/** + * \ingroup H5S + * + * \brief Refines a hyperslab selection with an operation, using a second + * hyperslab to modify it + * + * \space_id{space1_id} + * \param[in] op Selection operator + * \space_id{space2_id} + * + * \return \herr_t + * + * \details H5Smodify_select() refines an existing hyperslab selection + * \p space1_id with an operation \p op, using a second hyperslab + * \p space2_id. The first selection is modified to contain the + * result of \p space1_id operated on by \p space2_id. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id); +/** + * \ingroup H5S + * + * \brief Sets the offset of a simple dataspace + * + * \space_id + * \param[in] offset The offset at which to position the selection + * + * \return \herr_t + * + * \details H5Soffset_simple() sets the offset of a simple dataspace + * \p space_id. The offset array must be the same number of + * elements as the number of dimensions for the dataspace. If the + * \p offset array is set to NULL, the offset for the dataspace is + * reset to 0. + * + * This function allows the same shaped selection to be moved to + * different locations within a dataspace without requiring it to + * be redefined. + * + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); +/** + * \ingroup H5S + * + * \brief Closes a dataspace selection iterator + * + * \space_id{sel_iter_id} + * + * \return \herr_t + * + * \details H5Ssel_iter_close() closes a dataspace selection iterator + * specified by \p sel_iter_id, releasing its state. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id); /**\ingroup H5S * + * \brief Creates a dataspace selection iterator for a dataspace's selection + * + * \space_id{spaceid} + * \param[in] elmt_size Size of element in the selection + * \param[in] flags Selection iterator flag + * + * \return \hid_t{valid dataspace selection iterator} + * + * \details H5Ssel_iter_create() creates a selection iterator and initializes + * it to start at the first element selected in the dataspace. + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags); +/** + * \ingroup H5S + * + * \brief Retrieves a list of offset / length sequences for the elements in + * an iterator + * + * \space_id{sel_iter_id} + * \param[in] maxseq Maximum number of sequences to retrieve + * \param[in] maxbytes Maximum number of bytes to retrieve in sequences + * \param[out] nseq Number of sequences retrieved + * \param[out] nbytes Number of bytes retrieved, in all sequences + * \param[out] off Array of sequence offsets + * \param[out] len Array of sequence lengths + * + * \return \herr_t + * + * \details H5Ssel_iter_get_seq_list() retrieves a list of offset / length + * pairs (a list of "sequences") matching the selected elements for + * an iterator \p sel_iter_id, according to the iteration order for + * the iterator. The lengths returned are in bytes, not elements. + * + * Note that the iteration order for "all" and "hyperslab" + * selections is row-major (i.e. "C-ordered"), but the iteration + * order for "point" selections is "in order selected", unless the + * #H5S_SEL_ITER_GET_SEQ_LIST_SORTED flag is passed to + * H5Ssel_iter_create() for a point selection. + * + * \p maxseq and \p maxbytes specify the most sequences or bytes + * possible to place into the \p off and \p len arrays. \p nseq and + * \p nbytes return the actual number of sequences and bytes put + * into the arrays. + * + * Each call to H5Ssel_iter_get_seq_list() will retrieve the next + * set of sequences for the selection being iterated over. + * + * The total number of bytes possible to retrieve from a selection + * iterator is the \p elmt_size passed to H5Ssel_iter_create() + * multiplied by the number of elements selected in the dataspace + * the iterator was created from (which can be retrieved with + * H5Sget_select_npoints(). When there are no further sequences of + * elements to retrieve, calls to this routine will set \p nseq + * and \p nbytes to zero. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq, + size_t *nbytes, hsize_t *off, size_t *len); +/** + * \ingroup H5S + * + * \brief Resets a dataspace selection iterator back to an initial state + * + * \param[in] sel_iter_id Identifier of the dataspace selection iterator + * to reset + * \param[in] space_id Identifier of the dataspace with selection to + * iterate over + * + * \return \herr_t + * + * \details H5Ssel_iter_reset() resets a dataspace selection iterator back to + * an initial state so that the iterator may be used for iteration + * once again. + * + * \since 1.12.1 + * + */ +H5_DLL herr_t H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id); +/** + * \ingroup H5S + * + * \brief Adjusts a selection by subtracting an offset + * + * \space_id{spaceid} + * \param[in] offset Offset to subtract + * + * \return \herr_t + * + * \details H5Sselect_adjust() shifts a dataspace selection by a specified + * logical offset within the dataspace extent. + * + * \note This can be useful for VOL developers to implement chunked datasets. + * + * \since 1.12.0 + */ +H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset); +/** + * \ingroup H5S + * + * \brief Selects an entire dataspace + * + * \space_id{spaceid} + * + * \return \herr_t + * + * \details H5Sselect_all() selects the entire extent of the dataspace + * \p dspace_id. + * + * More specifically, H5Sselect_all() sets the selection type to + * #H5S_SEL_ALL, which specifies the entire dataspace anywhere it + * is applied. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Sselect_all(hid_t spaceid); +/** + * \ingroup H5S + * + * \brief Copies a selection from one dataspace to another + * + * \space_id{dst_id} + * \space_id{src_id} + * + * \return \herr_t + * + * \details H5Sselect_copy() copies all selection information (including + * offset) from the source dataspace \p src_id to the destination + * dataspace \p dst_id. + * + * \since 1.12.0 + * + */ +H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); +/** + * \ingroup H5S + * + * \brief Selects array elements to be included in the selection for a + * dataspace + * + * \space_id + * \param[in] op Operator specifying how the new selection is to be + * combined with the existing selection for the dataspace + * \param[in] num_elem Number of elements to be selected + * \param[in] coord A pointer to a buffer containing a serialized copy of + * a 2-dimensional array of zero-based values specifying + * the coordinates of the elements in the point selection + * + * \return \herr_t + * + * \details H5Sselect_elements() selects array elements to be included in + * the selection for the \p space_id dataspace. This is referred + * to as a point selection. + * + * The number of elements selected is set in the \p num_elements + * parameter. + * + * The \p coord parameter is a pointer to a buffer containing a + * serialized 2-dimensional array of size \p num_elements by the + * rank of the dataspace. The array lists dataset elements in the + * point selection; that is, it’s a list of of zero-based values + * specifying the coordinates in the dataset of the selected + * elements. The order of the element coordinates in the \p coord + * array specifies the order in which the array elements are + * iterated through when I/O is performed. Duplicate coordinate + * locations are not checked for. See below for examples of the + * mapping between the serialized contents of the buffer and the + * point selection array that it represents. + * + * The selection operator \p op determines how the new selection + * is to be combined with the previously existing selection for + * the dataspace. The following operators are supported: + * + * <table> + * <tr> + * <td>#H5S_SELECT_SET</td> + * <td>Replaces the existing selection with the parameters from + * this call. Overlapping blocks are not supported with this + * operator. Adds the new selection to the existing selection. + * </td> + * </tr> + * <tr> + * <td>#H5S_SELECT_APPEND</td> + * <td>Adds the new selection following the last element of the + * existing selection.</td> + * </tr> + * <tr> + * <td>#H5S_SELECT_PREPEND</td> + * <td>Adds the new selection preceding the first element of the + * existing selection.</td> + * </tr> + * </table> + * + * <b>Mapping the serialized \p coord buffer to a 2-dimensional + * point selection array:</b> + * To illustrate the construction of the contents of the \p coord + * buffer, consider two simple examples: a selection of 5 points in + * a 1-dimensional array and a selection of 3 points in a + * 4-dimensional array. + * + * In the 1D case, we will be selecting five points and a 1D + * dataspace has rank 1, so the selection will be described in a + * 5-by-1 array. To select the 1st, 14th, 17th, 23rd, 8th elements + * of the dataset, the selection array would be as follows + * (remembering that point coordinates are zero-based): + * \n 0 + * \n 13 + * \n 16 + * \n 22 + * \n 7 + * + * This point selection array will be serialized in the \p coord + * buffer as: + * \n 0 13 16 22 7 + * + * In the 4D case, we will be selecting three points and a 4D + * dataspace has rank 4, so the selection will be described in a + * 3-by-4 array. To select the points (1,1,1,1), (14,6,12,18), and + * (8,22,30,22), the point selection array would be as follows: + * \n 0 0 0 0 + * \n 13 5 11 17 + * \n 7 21 29 21 + * + * This point selection array will be serialized in the \p coord + * buffer as: + * \n 0 0 0 0 13 5 11 17 7 21 29 21 + * + * \version 1.6.4 C coord parameter type changed to \p const hsize_t. + * \version 1.6.4 Fortran \p coord parameter type changed to \p INTEGER(HSIZE_T). + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, size_t num_elem, const hsize_t *coord); +/** + * \ingroup H5S + * * \brief Selects a hyperslab region to add to the current selected region * * \space_id @@ -393,53 +1178,162 @@ H5_DLL int H5Sget_simple_extent_ndims(hid_t space_id); * \since 1.0.0 * */ -H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], - const hsize_t stride[], const hsize_t count[], const hsize_t block[]); -H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[], const hsize_t max[]); -H5_DLL hid_t H5Scopy(hid_t space_id); -H5_DLL herr_t H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl); -H5_DLL hid_t H5Sdecode(const void *buf); -H5_DLL hssize_t H5Sget_simple_extent_npoints(hid_t space_id); -H5_DLL htri_t H5Sis_simple(hid_t space_id); -H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); -H5_DLL herr_t H5Sset_extent_none(hid_t space_id); -H5_DLL herr_t H5Sextent_copy(hid_t dst_id, hid_t src_id); -H5_DLL htri_t H5Sextent_equal(hid_t sid1, hid_t sid2); - -/* Operations on dataspace selections */ -H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); -H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); -H5_DLL htri_t H5Sselect_valid(hid_t spaceid); -H5_DLL herr_t H5Sselect_adjust(hid_t spaceid, const hssize_t *offset); -H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]); -H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id); -H5_DLL htri_t H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *end); -H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); -H5_DLL herr_t H5Sselect_all(hid_t spaceid); -H5_DLL herr_t H5Sselect_none(hid_t spaceid); -H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, size_t num_elem, const hsize_t *coord); -H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid); -H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, - hsize_t buf[/*numpoints*/]); -H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], - const hsize_t _stride[], const hsize_t count[], const hsize_t _block[]); -H5_DLL herr_t H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id); -H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id); -H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid); -H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[], hsize_t count[], - hsize_t block[]); -H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid); -H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, - hsize_t buf[/*numblocks*/]); -H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, - hid_t src_intersect_space_id); - -/* Operations on dataspace selection iterators */ -H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags); -H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq, - size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL herr_t H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id); -H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id); +H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], + const hsize_t stride[], const hsize_t count[], const hsize_t block[]); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Checks if current selection intersects with a block + * + * \space_id + * \param[in] start Starting coordinate of block + * \param[in] end Opposite ("ending") coordinate of block + * + * \return \htri_t + * + * \details H5Sselect_intersect_block() checks to see if the current + * selection \p space_id in the dataspace intersects with the block + * specified by \p start and \p end. + * + * \note Assumes that \p start & \p end block bounds are inclusive, so + * \p start == \p end value is OK. + * + * \since 1.12.0 + * + */ +H5_DLL htri_t H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *end); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Resets the selection region to include no elements + * + * \space_id{spaceid} + * + * \return \herr_t + * + * \details H5Sselect_none() resets the selection region for the dataspace + * \p space_id to include no elements. + * + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Sselect_none(hid_t spaceid); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Projects the intersection of two source selections to a + * destination selection + * + * \space_id{src_space_id} + * \space_id{dst_space_id} + * \space_id{src_intersect_space_id} + * + * \return Returns a dataspace with a selection equal to the intersection of + * \p src_intersect_space_id and \p src_space_id projected from + * \p src_space to \p dst_space on success, negative on failure. + * + * \details H5Sselect_project_intersection() computes the intersection + * between two dataspace selections and projects that intersection + * into a third selection.This can be useful for VOL developers to + * implement chunked or virtual datasets. + * + * \since 1.12.0 + * + */ +H5_DLL hid_t H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, + hid_t src_intersect_space_id); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Checks if two selections are the same shape + * + * \space_id{space1_id} + * \space_id{space2_id} + * + * \return \htri_t + * + * \details H5Sselect_shape_same() checks to see if the current selection + * in the dataspaces are the same dimensionality and shape. + * + * This is primarily used for reading the entire selection in + * one swoop. + * + * \since 1.12.0 + * + */ +H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Verifies that the selection is within the extent of the dataspace + * + * \space_id{spaceid} + * + * \return \htri_t + * + * \details H5Sselect_valid() verifies that the selection for the dataspace + * \p space_id is within the extent of the dataspace if the current + * offset for the dataspace is used. + * + * \version 1.4.0 Fortran subroutine introduced in this release. + * \since 1.0.0 + * + */ +H5_DLL htri_t H5Sselect_valid(hid_t spaceid); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Resets the extent of a dataspace back to "none" + * + * \space_id + * + * \return \herr_t + * + * \details H5Sset_extent_none() resets the type of a dataspace to + * #H5S_NULL with no extent information stored for the dataspace. + * + * \version 1.10.7, 1.12.1 The function behavior changed. The previous + * behavior was to set the class to #H5S_NO_CLASS. + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Sset_extent_none(hid_t space_id); +/*--------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Sets or resets the size of an existing dataspace + * + * \space_id + * \param[in] rank Rank, or dimensionality, of the dataspace + * \param[in] dims Array containing current size of dataspace + * \param[in] max Array containing maximum size of dataspace + * + * \return \herr_t + * + * \details H5Sset_extent_simple() sets or resets the size of an existing + * dataspace. + * + * \p rank is the dimensionality, or number of dimensions, of the + * dataspace. + * + * \p dims is an array of size \p rank which contains the new size + * of each dimension in the dataspace. \p max is an array of size + * \p rank which contains the maximum size of each dimension in + * the dataspace. + * + * Any previous extent is removed from the dataspace, the dataspace + * type is set to #H5S_SIMPLE, and the extent is set as specified. + * + * Note that a dataset must be chunked if \p dims does not equal + * \p max. + * + * + * \version 1.4.0 Fortran subroutine was introduced. + * \since 1.0.0 + * + */ +H5_DLL herr_t H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[], const hsize_t max[]); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -447,6 +1341,47 @@ H5_DLL herr_t H5Ssel_iter_close(hid_t sel_iter_id); */ #ifndef H5_NO_DEPRECATED_SYMBOLS /* Function prototypes */ +/* --------------------------------------------------------------------------*/ +/**\ingroup H5S + * + * \brief Encodes a data space object description into a binary buffer + * + * \space_id{obj_id} + * \param[in,out] buf Buffer for the object to be encoded into; + * If the provided buffer is NULL, only the size of + * buffer needed is returned through \p nalloc. + * \param[in,out] nalloc The size of the allocated buffer + * + * \return \herr_t + * + * \deprecated Deprecated in favor of H5Sencode2() + * + * \details Given the data space identifier \p obj_id, H5Sencode1() converts + * a data space description into binary form in a buffer. Using + * this binary form in the buffer, a data space object can be + * reconstructed using H5Sdecode() to return a new object handle + * (\p hid_t) for this data space. + * + * A preliminary H5Sencode1() call can be made to find out the size + * of the buffer needed. This value is returned as \p nalloc. That + * value can then be assigned to \p nalloc for a second H5Sencode1() + * call, which will retrieve the actual encoded object. + * + * If the library finds out \p nalloc is not big enough for the + * object, it simply returns the size of the buffer needed through + * \p nalloc without encoding the provided buffer. + * + * The types of data space addressed in this function are null, + * scalar, and simple space. For a simple data space, the information + * on the selection, for example, hyperslab selection, is also + * encoded and decoded. A complex data space has not been + * implemented in the library. + * + * \version 1.12.0 The function H5Sencode() was renamed H5Sencode1() and + * deprecated. + * \since 1.8.0 + * + */ H5_DLL herr_t H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h index 4f9edde..c489edc 100644 --- a/src/H5Tmodule.h +++ b/src/H5Tmodule.h @@ -44,12 +44,8 @@ * \ingroup H5T * \defgroup ENUM Enumeration Datatypes * \ingroup H5T - * \defgroup GTO General Datatype Operations - * \ingroup H5T * \defgroup OPAQUE Opaque Datatypes * \ingroup H5T - * \defgroup STRING String Datatypes - * \ingroup H5T * \defgroup VLEN Variable-length Sequence Datatypes * \ingroup H5T * diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index a6a1ef2..b708506 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -28,7 +28,7 @@ * internal If this goes over 16 types (0-15), the file format will need to * change. */ -//! [H5T_class_t_snip] +//! <!-- [H5T_class_t_snip] --> typedef enum H5T_class_t { H5T_NO_CLASS = -1, /**< error */ H5T_INTEGER = 0, /**< integer types */ @@ -45,12 +45,12 @@ typedef enum H5T_class_t { H5T_NCLASSES /**< sentinel: this must be last */ } H5T_class_t; -//! [H5T_class_t_snip] +//! <!-- [H5T_class_t_snip] --> /** * Byte orders */ -//! [H5T_order_t_snip] +//! <!-- [H5T_order_t_snip] --> typedef enum H5T_order_t { H5T_ORDER_ERROR = -1, /**< error */ H5T_ORDER_LE = 0, /**< little endian */ @@ -60,12 +60,12 @@ typedef enum H5T_order_t { H5T_ORDER_NONE = 4 /**< no particular order (strings, bits,..) */ /*H5T_ORDER_NONE must be last */ } H5T_order_t; -//! [H5T_order_t_snip] +//! <!-- [H5T_order_t_snip] --> /** * Types of integer sign schemes */ -//! [H5T_sign_t_snip] +//! <!-- [H5T_sign_t_snip] --> typedef enum H5T_sign_t { H5T_SGN_ERROR = -1, /**< error */ H5T_SGN_NONE = 0, /**< this is an unsigned type */ @@ -73,12 +73,12 @@ typedef enum H5T_sign_t { H5T_NSGN = 2 /** sentinel: this must be last! */ } H5T_sign_t; -//! [H5T_sign_t_snip] +//! <!-- [H5T_sign_t_snip] --> /** * Floating-point normalization schemes */ -//! [H5T_norm_t_snip] +//! <!-- [H5T_norm_t_snip] --> typedef enum H5T_norm_t { H5T_NORM_ERROR = -1, /**< error */ H5T_NORM_IMPLIED = 0, /**< msb of mantissa isn't stored, always 1 */ @@ -86,7 +86,7 @@ typedef enum H5T_norm_t { H5T_NORM_NONE = 2 /**< not normalized */ /*H5T_NORM_NONE must be last */ } H5T_norm_t; -//! [H5T_norm_t_snip] +//! <!-- [H5T_norm_t_snip] --> /** * Character set to use for text strings. @@ -141,7 +141,7 @@ typedef enum H5T_str_t { /** * Type of padding to use in other atomic types */ -//! [H5T_pad_t_snip] +//! <!-- [H5T_pad_t_snip] --> typedef enum H5T_pad_t { H5T_PAD_ERROR = -1, /**< error */ H5T_PAD_ZERO = 0, /**< always set to zero */ @@ -150,7 +150,7 @@ typedef enum H5T_pad_t { H5T_NPAD = 3 /**< sentinal: THIS MUST BE LAST */ } H5T_pad_t; -//! [H5T_pad_t_snip] +//! <!-- [H5T_pad_t_snip] --> /** * Commands sent to conversion functions @@ -173,14 +173,14 @@ typedef enum H5T_bkg_t { /** * Type conversion client data */ -//! [H5T_cdata_t_snip] +//! <!-- [H5T_cdata_t_snip] --> typedef struct H5T_cdata_t { H5T_cmd_t command; /**< what should the conversion function do? */ H5T_bkg_t need_bkg; /**< is the background buffer needed? */ hbool_t recalc; /**< recalculate private data */ void * priv; /**< private data */ } H5T_cdata_t; -//! [H5T_cdata_t_snip] +//! <!-- [H5T_cdata_t_snip] --> /** * Conversion function persistence @@ -194,25 +194,32 @@ typedef enum H5T_pers_t { /** * The order to retrieve atomic native datatype */ -//! [H5T_direction_t_snip] +//! <!-- [H5T_direction_t_snip] --> typedef enum H5T_direction_t { H5T_DIR_DEFAULT = 0, /**< default direction is inscendent */ H5T_DIR_ASCEND = 1, /**< in inscendent order */ H5T_DIR_DESCEND = 2 /**< in descendent order */ } H5T_direction_t; -//! [H5T_direction_t_snip] +//! <!-- [H5T_direction_t_snip] --> /** * The exception type passed into the conversion callback function */ typedef enum H5T_conv_except_t { - H5T_CONV_EXCEPT_RANGE_HI = 0, /**< source value is greater than destination's range */ - H5T_CONV_EXCEPT_RANGE_LOW = 1, /**< source value is less than destination's range */ - H5T_CONV_EXCEPT_PRECISION = 2, /**< source value loses precision in destination */ - H5T_CONV_EXCEPT_TRUNCATE = 3, /**< source value is truncated in destination */ - H5T_CONV_EXCEPT_PINF = 4, /**< source value is positive infinity(floating number) */ - H5T_CONV_EXCEPT_NINF = 5, /**< source value is negative infinity(floating number) */ - H5T_CONV_EXCEPT_NAN = 6 /**< source value is NaN(floating number) */ + H5T_CONV_EXCEPT_RANGE_HI = 0, + /**< Source value is greater than destination's range */ + H5T_CONV_EXCEPT_RANGE_LOW = 1, + /**< Source value is less than destination's range */ + H5T_CONV_EXCEPT_PRECISION = 2, + /**< Source value loses precision in destination */ + H5T_CONV_EXCEPT_TRUNCATE = 3, + /**< Source value is truncated in destination */ + H5T_CONV_EXCEPT_PINF = 4, + /**< Source value is positive infinity */ + H5T_CONV_EXCEPT_NINF = 5, + /**< Source value is negative infinity */ + H5T_CONV_EXCEPT_NAN = 6 + /**< Source value is \c NaN (not a number, including \c QNaN and \c SNaN) */ } H5T_conv_except_t; /** @@ -254,17 +261,31 @@ extern "C" { /** * All datatype conversion functions are... */ -//! [H5T_conv_t_snip] +//! <!-- [H5T_conv_t_snip] --> typedef herr_t (*H5T_conv_t)(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); -//! [H5T_conv_t_snip] +//! <!-- [H5T_conv_t_snip] --> +//! <!-- [H5T_conv_except_func_t_snip] --> /** - * Exception handler. If an exception like overflow happenes during conversion, - * this function is called if it's registered through H5Pset_type_conv_cb(). + * \brief Exception handler. + * + * \param[in] except_type The kind of exception that occurred + * \param[in] src_id Source datatype identifier + * \param[in] dst_id Destination datatype identifier + * \param[in] src_buf Source data buffer + * \param[in,out] dst_buf Destination data buffer + * \param[in,out] user_data Callback context + * \returns Valid callback function return values are #H5T_CONV_ABORT, + * #H5T_CONV_UNHANDLED and #H5T_CONV_HANDLED. + * + * \details If an exception like overflow happenes during conversion, this + * function is called if it's registered through H5Pset_type_conv_cb(). + * */ typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(H5T_conv_except_t except_type, hid_t src_id, hid_t dst_id, void *src_buf, void *dst_buf, void *user_data); +//! <!-- [H5T_conv_except_func_t_snip] --> /* When this header is included from a private header, don't make calls to H5open() */ #undef H5OPEN @@ -1061,7 +1082,7 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g; * predefined datatype. * * When creating a variable-length string datatype, \p size must - * be #H5T_VARIABLE. + * be #H5T_VARIABLE; see \ref_vlen_strings. * * When creating a fixed-length string datatype, \p size will * be the length of the string in bytes. The length of the @@ -1075,13 +1096,9 @@ H5_DLLVAR hid_t H5T_NATIVE_UINT_FAST64_g; * The datatype identifier returned from this function should be * released with H5Tclose or resource leaks will result. * - * \since 1.2.0 - * * \see H5Tclose() * - * \todo Original has a reference to “Creating variable-length string - * datatypes”. - * \todo Create an example for H5Tcreate. + * \since 1.2.0 * */ H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size); @@ -1106,8 +1123,6 @@ H5_DLL hid_t H5Tcreate(H5T_class_t type, size_t size); * The returned datatype identifier should be released with H5Tclose() * to prevent resource leak. * - * \todo Create an example for H5Tcopy(). - * */ H5_DLL hid_t H5Tcopy(hid_t type_id); /** @@ -1472,8 +1487,6 @@ H5_DLL herr_t H5Trefresh(hid_t type_id); * * \since 1.2.0 * - * \todo Create example for H5Tinsert - * */ H5_DLL herr_t H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id); /** @@ -1632,10 +1645,7 @@ H5_DLL herr_t H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/) * character base type creates a variable-length sequence of strings * (a variable-length, 1-dimensional array), with each element of * the array being of the string or character base type.\n - * To create a variable-length string datatype, see "Creating - * variable-length string datatypes." - * - * \todo Fix the reference. + * To create a variable-length string datatype, see \ref_vlen_strings. * */ H5_DLL hid_t H5Tvlen_create(hid_t base_id); @@ -1839,13 +1849,9 @@ H5_DLL htri_t H5Tdetect_class(hid_t type_id, H5T_class_t cls); * actual data and a size value. This function does not return the * size of actual variable-length sequence data. * - * \since 1.2.0 - * * \see H5Tset_size() * - * \todo Original has a reference to “Creating variable-length string datatypes”. - * \todo Create an example for H5Tget_size(). - * + * \since 1.2.0 */ H5_DLL size_t H5Tget_size(hid_t type_id); /** @@ -2059,7 +2065,7 @@ H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id); */ H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id); /** - * \ingroup COMPOUND + * \ingroup COMPOUND ENUM * * \brief Retrieves the number of elements in a compound or enumeration datatype * @@ -2076,7 +2082,7 @@ H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id); */ H5_DLL int H5Tget_nmembers(hid_t type_id); /** - * \ingroup COMPOUND + * \ingroup COMPOUND ENUM * * \brief Retrieves the name of a compound or enumeration datatype member * @@ -2103,7 +2109,7 @@ H5_DLL int H5Tget_nmembers(hid_t type_id); */ H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno); /** - * \ingroup COMPOUND + * \ingroup COMPOUND ENUM * * \brief Retrieves the index of a compound or enumeration datatype member * @@ -2375,6 +2381,7 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction); * * \li Variable-length string datatypes: If \p dtype_id is a * variable-length string, size must normally be set to #H5T_VARIABLE. + * See \ref_vlen_strings. * * \li Compound datatypes: This function may be used to increase or * decrease the size of a compound datatype, but the function will @@ -2385,12 +2392,9 @@ H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction); * variable-length array datatypes (#H5T_VLEN), or reference datatypes * (#H5T_REFERENCE). * - * \since 1.2.0 - * * \see H5Tget_size() * - *\todo Create an example for H5Tset_size(). - *\todo Original has a reference to “Creating variable-length string datatypes”. + * \since 1.2.0 * */ H5_DLL herr_t H5Tset_size(hid_t type_id, size_t size); @@ -2842,7 +2846,7 @@ H5_DLL htri_t H5Tcompiler_conv(hid_t src_id, hid_t dst_id); * enough to hold the larger of the input and output data. * * \version 1.6.3 \p nelmts parameter type changed to size_t. - * \version 1.4.0 \p nelmts parameter type changed to \ref hsize_t. + * \version 1.4.0 \p nelmts parameter type changed to hsize_t. * */ H5_DLL herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *background, @@ -2875,6 +2879,7 @@ H5_DLL herr_t H5Treclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *bu * * Use of these symbols is deprecated. */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 8177939..de3f6b3 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -442,7 +442,7 @@ typedef struct H5VL_token_class_t { * \ingroup H5VLDEV * Class information for each VOL connector */ -//! [H5VL_class_t_snip] +//! <!-- [H5VL_class_t_snip] --> typedef struct H5VL_class_t { /* Overall connector fields & callbacks */ unsigned version; /**< VOL connector class struct version # */ @@ -475,7 +475,7 @@ typedef struct H5VL_class_t { herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments); /**< Optional callback */ } H5VL_class_t; -//! [H5VL_class_t_snip] +//! <!-- [H5VL_class_t_snip] --> /********************/ /* Public Variables */ @@ -512,15 +512,14 @@ extern "C" { * uncommon, as most VOL-specific properties are added to the file * access property list via the connector's API calls which set the * VOL connector for the file open/create. For more information, see - * the VOL documentation. + * the \ref_vol_doc. * * H5VL_class_t is defined in H5VLconnector.h in the source code. It * contains class information for each VOL connector: * \snippet this H5VL_class_t_snip * - * \todo Fix the reference to VOL documentation. - * * \since 1.12.0 + * */ H5_DLL hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); /** diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 167b18a..aec4851 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -74,9 +74,9 @@ * connectors. Subsequent values should be obtained from the HDF5 * development team at mailto:help@hdfgroup.org. */ -//! [H5VL_class_value_t_snip] +//! <!-- [H5VL_class_value_t_snip] --> typedef int H5VL_class_value_t; -//! [H5VL_class_value_t_snip] +//! <!-- [H5VL_class_value_t_snip] --> /** * \ingroup H5VLDEF @@ -134,11 +134,10 @@ extern "C" { * uncommon, as most VOL-specific properties are added to the file * access property list via the connector's API calls which set the * VOL connector for the file open/create. For more information, see - * the VOL documentation. - * - * \todo Fix the reference to VOL documentation. + * \ref_vol_doc. * * \since 1.12.0 + * */ H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id); /** @@ -173,11 +172,10 @@ H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vi * uncommon, as most VOL-specific properties are added to the file * access property list via the connector's API calls which set the * VOL connector for the file open/create. For more information, see - * the VOL documentation. - * - * \todo Fix the reference to VOL documentation. + * the \ref_vol_doc. * * \since 1.12.0 + * */ H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id); /** diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h index 25007b3..76a2380 100644 --- a/src/H5Zmodule.h +++ b/src/H5Zmodule.h @@ -77,11 +77,9 @@ * Custom filters that have been registered with the library will have * additional unique identifiers. * - * See \Emph{HDF5 Dynamically Loaded Filters} for more information on - * how an HDF5 application can apply a filter that is not registered - * with the HDF5 library. - * - * \todo Fix the reference. + * See \ref_dld_filters for more information on how an HDF5 + * application can apply a filter that is not registered with the HDF5 + * library. * * \defgroup H5ZPRE Predefined Filters * \ingroup H5Z diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h index 4c9b006..90277cf 100644 --- a/src/H5Zpublic.h +++ b/src/H5Zpublic.h @@ -230,16 +230,18 @@ typedef enum H5Z_EDC_t { * Return values for filter callback function */ typedef enum H5Z_cb_return_t { - H5Z_CB_ERROR = -1, - H5Z_CB_FAIL = 0, /**< I/O should fail if filter fails. */ - H5Z_CB_CONT = 1, /**< I/O continues if filter fails. */ - H5Z_CB_NO = 2 + H5Z_CB_ERROR = -1, /**< error value */ + H5Z_CB_FAIL = 0, /**< I/O should fail if filter fails. */ + H5Z_CB_CONT = 1, /**< I/O continues if filter fails. */ + H5Z_CB_NO = 2 /**< sentinel */ } H5Z_cb_return_t; +//! <!-- [H5Z_filter_func_t_snip] --> /** * Filter callback function definition */ typedef H5Z_cb_return_t (*H5Z_filter_func_t)(H5Z_filter_t filter, void *buf, size_t buf_size, void *op_data); +//! <!-- [H5Z_filter_func_t_snip] --> /** * Structure for filter callback property @@ -254,58 +256,93 @@ extern "C" { #endif /** - * \details Before a dataset gets created, the \c can_apply callbacks for any - * filters used in the dataset creation property list are called with - * the dataset's dataset creation property list, the dataset's - * datatype and a dataspace describing a chunk (for chunked dataset - * storage). + * \brief This callback determines if a filter can be applied to the dataset + * with the characteristics provided * - * The \c can_apply callback must determine if the combination of the - * dataset creation property list setting, the datatype and the - * dataspace represent a valid combination to apply this filter to. - * For example, some cases of invalid combinations may involve the - * filter not operating correctly on certain datatypes (or certain - * datatype sizes), or certain sizes of the chunk dataspace. + * \dcpl_id + * \type_id + * \space_id * - * The \c can_apply callback can be the NULL pointer, in which case, - * the library will assume that it can apply to any combination of - * dataset creation property list values, datatypes and dataspaces. + * \return \htri_t * - * The \c can_apply callback returns positive a valid combination, - * zero for an invalid combination and negative for an error. - */ -//! [H5Z_can_apply_func_t_snip] + * \details Before a dataset gets created, the \ref H5Z_can_apply_func_t + * callbacks for any filters used in the dataset creation property list + * are called with the dataset's dataset creation property list, the + * dataset's datatype and a dataspace describing a chunk (for chunked + * dataset storage). + * + * The \ref H5Z_can_apply_func_t callback must determine if the + * combination of the dataset creation property list setting, the + * datatype and the dataspace represent a valid combination to apply + * this filter to. For example, some cases of invalid combinations may + * involve the filter not operating correctly on certain datatypes (or + * certain datatype sizes), or certain sizes of the chunk dataspace. + * + * The \ref H5Z_can_apply_func_t callback can be the NULL pointer, in + * which case, the library will assume that it can apply to any + * combination of dataset creation property list values, datatypes and + * dataspaces. + * + * The \ref H5Z_can_apply_func_t callback returns positive a valid + * combination, zero for an invalid combination and negative for an + * error. + */ +//! <!-- [H5Z_can_apply_func_t_snip] --> typedef htri_t (*H5Z_can_apply_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); -//! [H5Z_can_apply_func_t_snip] -/** - * \details After the "can_apply" callbacks are checked for new datasets, the - * \c set_local callbacks for any filters used in the dataset creation - * property list are called. These callbacks receive the dataset's - * private copy of the dataset creation property list passed in to - * H5Dcreate() (i.e. not the actual property list passed in to - * H5Dcreate()) and the datatype ID passed in to H5Dcreate() (which is - * not copied and should not be modified) and a dataspace describing - * the chunk (for chunked dataset storage) (which should also not be - * modified). - * - * The \c set_local callback must set any parameters that are specific - * to this dataset, based on the combination of the dataset creation - * property list values, the datatype and the dataspace. For example, - * some filters perform different actions based on different datatypes - * (or datatype sizes) or different number of dimensions or dataspace - * sizes. +//! <!-- [H5Z_can_apply_func_t_snip] --> +/** + * \brief The filter operation callback function, defining a filter's operation + * on data * - * The \c set_local callback can be the NULL pointer, in which case, - * the library will assume that there are no dataset-specific settings - * for this filter. + * \dcpl_id + * \type_id + * \space_id * - * The \c set_local callback must return non-negative on success and - * negative for an error. - */ -//! [H5Z_set_local_func_t_snip] + * \return \herr_t + * + * \details After the \ref H5Z_can_apply_func_t callbacks are checked for new + * datasets, the \ref H5Z_set_local_func_t callbacks for any filters + * used in the dataset creation property list are called. These + * callbacks receive the dataset's private copy of the dataset creation + * property list passed in to H5Dcreate() (i.e. not the actual property + * list passed in to H5Dcreate()) and the datatype ID passed in to + * H5Dcreate() (which is not copied and should not be modified) and a + * dataspace describing the chunk (for chunked dataset storage) (which + * should also not be modified). + * + * The \ref H5Z_set_local_func_t callback must set any parameters that + * are specific to this dataset, based on the combination of the + * dataset creation property list values, the datatype and the + * dataspace. For example, some filters perform different actions based + * on different datatypes (or datatype sizes) or different number of + * dimensions or dataspace sizes. + * + * The \ref H5Z_set_local_func_t callback can be the NULL pointer, in + * which case, the library will assume that there are no + * dataset-specific settings for this filter. + * + * The \ref H5Z_set_local_func_t callback must return non-negative on + * success and negative for an error. + */ +//! <!-- [H5Z_set_local_func_t_snip] --> typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space_id); -//! [H5Z_set_local_func_t_snip] +//! <!-- [H5Z_set_local_func_t_snip] --> + /** + * \brief The filter operation callback function, defining a filter's operation + * on data + * + * \param[in] flags Bit vector specifying certain general properties of the filter + * \param[in] cd_nelmts Number of elements in \p cd_values + * \param[in] cd_values Auxiliary data for the filter + * \param[in] nbytes The number of valid bytes in \p buf to be filtered + * \param[in,out] buf_size The size of \p buf + * \param[in,out] buf The filter buffer + * + * \return Returns the number of valid bytes of data contained in \p buf. In the + * case of failure, the return value is 0 (zero) and all pointer + * arguments are left unchanged. + * * \details A filter gets definition flags and invocation flags (defined * above), the client data array and size defined when the filter was * added to the pipeline, the size in bytes of the data on which to @@ -321,15 +358,15 @@ typedef herr_t (*H5Z_set_local_func_t)(hid_t dcpl_id, hid_t type_id, hid_t space * output buffer. If an error occurs then the function should return * zero and leave all pointer arguments unchanged. */ -//! [H5Z_func_t_snip] +//! <!-- [H5Z_func_t_snip] --> typedef size_t (*H5Z_func_t)(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t *buf_size, void **buf); -//! [H5Z_func_t_snip] +//! <!-- [H5Z_func_t_snip] --> /** * The filter table maps filter identification numbers to structs that * contain a pointers to the filter function and timing statistics. */ -//! [H5Z_class2_t_snip] +//! <!-- [H5Z_class2_t_snip] --> typedef struct H5Z_class2_t { int version; /**< Version number of the H5Z_class_t struct */ H5Z_filter_t id; /**< Filter ID number */ @@ -340,7 +377,7 @@ typedef struct H5Z_class2_t { H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ H5Z_func_t filter; /**< The actual filter function */ } H5Z_class2_t; -//! [H5Z_class2_t_snip] +//! <!-- [H5Z_class2_t_snip] --> /** * \ingroup H5Z @@ -635,7 +672,7 @@ H5_DLL herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_confi * The filter table maps filter identification numbers to structs that * contain a pointers to the filter function and timing statistics. */ -//! [H5Z_class1_t_snip] +//! <!-- [H5Z_class1_t_snip] --> typedef struct H5Z_class1_t { H5Z_filter_t id; /**< Filter ID number */ const char * name; /**< Comment for debugging */ @@ -643,7 +680,7 @@ typedef struct H5Z_class1_t { H5Z_set_local_func_t set_local; /**< The "set local" callback for a filter */ H5Z_func_t filter; /**< The actual filter function */ } H5Z_class1_t; -//! [H5Z_class1_t_snip] +//! <!-- [H5Z_class1_t_snip] --> #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5public.h b/src/H5public.h index be0f9e7..6238705 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -92,50 +92,130 @@ extern "C" { #endif /* Version numbers */ -#define H5_VERS_MAJOR 1 /* For major interface/format changes */ -#define H5_VERS_MINOR 12 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 1 /* For tweaks, bug-fixes, or development */ -#define H5_VERS_SUBRELEASE "4" /* For pre-releases like snap0 */ -/* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.12.1-4" /* Full version string */ +/** + * For major interface/format changes + */ +#define H5_VERS_MAJOR 1 +/** + * For minor interface/format changes + */ +#define H5_VERS_MINOR 12 +/** + * For tweaks, bug-fixes, or development + */ +#define H5_VERS_RELEASE 1 +/** + * For pre-releases like \c snap0. Empty string for official releases. + */ +#define H5_VERS_SUBRELEASE "4" +/** + * Full version string + */ +#define H5_VERS_INFO "HDF5 library version: 1.12.1-4" #define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE) /* macros for comparing the version */ +/** + * \brief Determines whether the version of the library being used is greater + * than or equal to the specified version + * + * \param[in] Maj Major version number - A non-negative integer value + * \param[in] Min Minor version number - A non-negative integer value + * \param[in] Rel Release version number - A non-negative integer value + * \returns A value of 1 is returned if the library version is greater than + * or equal to the version number specified.\n + * A value of 0 is returned if the library version is less than the + * version number specified.\n + * A library version is greater than the specified version number if + * its major version is larger than the specified major version + * number. If the major version numbers are the same, it is greater + * than the specified version number if its minor version is larger + * than the specified minor version number. If the minor version + * numbers are the same, then a library version would be greater than + * the specified version number if its release number is larger than + * the specified release number. + * + * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile + * time to conditionally include or exclude code based on the version + * of the HDF5 library against which an application will be linked. + * + * The #H5_VERSION_GE macro compares the version of the HDF5 library + * being used against the version number specified in the parameters. + * + * For more information about release versioning, see \ref_h5lib_relver. + * + * \since 1.8.7 + * + */ #define H5_VERSION_GE(Maj, Min, Rel) \ (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE >= Rel)) || \ ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR > Min)) || (H5_VERS_MAJOR > Maj)) +/** + * \brief Determines whether the version of the library being used is less + * than or equal to the specified version + * + * \param[in] Maj Major version number - A non-negative integer value + * \param[in] Min Minor version number - A non-negative integer value + * \param[in] Rel Release version number - A non-negative integer value + * \returns A value of 1 is returned if the library version is less than + * or equal to the version number specified.\n + * A value of 0 is returned if the library version is greater than the + * version number specified.\n + * A library version is less than the specified version number if + * its major version is smaller than the specified major version + * number. If the major version numbers are the same, it is smaller + * than the specified version number if its minor version is smaller + * than the specified minor version number. If the minor version + * numbers are the same, then a library version would be smaller than + * the specified version number if its release number is smaller than + * the specified release number. + * + * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile + * time to conditionally include or exclude code based on the version + * of the HDF5 library against which an application will be linked. + * + * The #H5_VERSION_LE macro compares the version of the HDF5 library + * being used against the version number specified in the parameters. + * + * For more information about release versioning, see \ref_h5lib_relver. + * + * \since 1.8.7 + * + */ #define H5_VERSION_LE(Maj, Min, Rel) \ (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE <= Rel)) || \ ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR < Min)) || (H5_VERS_MAJOR < Maj)) -/* +/** * Status return values. Failed integer functions in HDF5 result almost * always in a negative value (unsigned failing functions sometimes return * zero for failure) while successful return is non-negative (often zero). * The negative failure value is most commonly -1, but don't bet on it. The * proper way to detect failure is something like: - * - * if((dset = H5Dopen2(file, name)) < 0) - * fprintf(stderr, "unable to open the requested dataset\n"); + * \code + * if((dset = H5Dopen2(file, name)) < 0) + * fprintf(stderr, "unable to open the requested dataset\n"); + * \endcode */ typedef int herr_t; -/* +/** * Boolean type. Successful return values are zero (false) or positive * (true). The typical true value is 1 but don't bet on it. Boolean - * functions cannot fail. Functions that return `htri_t' however return zero + * functions cannot fail. Functions that return #htri_t however return zero * (false), positive (true), or negative (failure). The proper way to test - * for truth from a htri_t function is: - * - * if ((retval = H5Tcommitted(type)) > 0) { - * printf("data type is committed\n"); - * } else if (!retval) { - * printf("data type is not committed\n"); - * } else { - * printf("error determining whether data type is committed\n"); - * } + * for truth from a #htri_t function is: + * \code + * if ((retval = H5Tcommitted(type)) > 0) { + * printf("data type is committed\n"); + * } else if (!retval) { + * printf("data type is not committed\n"); + * } else { + * printf("error determining whether data type is committed\n"); + * } + * \endcode */ #ifdef H5_HAVE_STDBOOL_H #include <stdbool.h> @@ -304,8 +384,7 @@ typedef unsigned long uint32_t; #error "nothing appropriate for uint32_t" #endif -//! [H5_iter_order_t_snip] - +//! <!-- [H5_iter_order_t_snip] --> /** * Common iteration orders */ @@ -316,8 +395,7 @@ typedef enum { H5_ITER_NATIVE, /**< No particular order, whatever is fastest */ H5_ITER_N /**< Number of iteration orders */ } H5_iter_order_t; - -//! [H5_iter_order_t_snip] +//! <!-- [H5_iter_order_t_snip] --> /* Iteration callback values */ /* (Actually, any positive value will cause the iterator to stop and pass back @@ -327,8 +405,7 @@ typedef enum { #define H5_ITER_CONT (0) #define H5_ITER_STOP (1) -//! [H5_index_t_snip] - +//! <!-- [H5_index_t_snip] --> /** * The types of indices on links in groups/attributes on objects. * Primarily used for "<do> <foo> by index" routines and for iterating over @@ -340,18 +417,17 @@ typedef enum H5_index_t { H5_INDEX_CRT_ORDER, /**< Index on creation order */ H5_INDEX_N /**< Number of indices defined */ } H5_index_t; - -//! [H5_index_t_snip] +//! <!-- [H5_index_t_snip] --> /** * Storage info struct used by H5O_info_t and H5F_info_t */ -//! [H5_ih_info_t_snip] +//! <!-- [H5_ih_info_t_snip] --> typedef struct H5_ih_info_t { hsize_t index_size; /**< btree and/or list */ hsize_t heap_size; } H5_ih_info_t; -//! [H5_ih_info_t_snip] +//! <!-- [H5_ih_info_t_snip] --> /** * The maximum size allowed for tokens @@ -361,17 +437,17 @@ typedef struct H5_ih_info_t { */ #define H5O_MAX_TOKEN_SIZE (16) -//! [H5O_token_t_snip] - +//! <!-- [H5O_token_t_snip] --> /** + * Type for object tokens + * * \internal (Hoisted here, since it's used by both the - * H5Lpublic.h and H5Opublic.h headers) */ -/* Type for object tokens */ + * H5Lpublic.h and H5Opublic.h headers) + */ typedef struct H5O_token_t { uint8_t __data[H5O_MAX_TOKEN_SIZE]; } H5O_token_t; - -//! [H5O_token_t_snip] +//! <!-- [H5O_token_t_snip] --> /** * Allocation statistics info struct diff --git a/src/Makefile.am b/src/Makefile.am index c58f8ae..a4d57ec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,9 +19,6 @@ include $(top_srcdir)/config/commence.am include $(top_srcdir)/config/lt_vers.am -# include Doxygen rules (requires autoconf-archive >2016-03-20) -@DX_RULES@ - # How to build H5detect for number format detection. # Use -g to force no optimization since many compilers (e.g., Intel) takes # a long time to compile it with any optimization on. H5detect is used @@ -198,11 +195,6 @@ $(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt $(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt perl $(top_srcdir)/bin/make_overflow $? -# doxygen support -if BUILD_DOXYGEN_CONDITIONAL -doxygen: doxygen-doc -endif - # Add TRACE macros to library source files. This is done via the trace script # in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean" # version of the source file is saved with a tilde (~) after its name and |