diff --git a/HDF5Examples/JAVA/TUTR/H5_CreateGroupAbsoluteRelative.java b/HDF5Examples/JAVA/TUTR/HDF5GroupAbsoluteRelativeCreate.java similarity index 95% rename from HDF5Examples/JAVA/TUTR/H5_CreateGroupAbsoluteRelative.java rename to HDF5Examples/JAVA/TUTR/HDF5GroupAbsoluteRelativeCreate.java index 934242de798..9061c31c44f 100644 --- a/HDF5Examples/JAVA/TUTR/H5_CreateGroupAbsoluteRelative.java +++ b/HDF5Examples/JAVA/TUTR/HDF5GroupAbsoluteRelativeCreate.java @@ -17,8 +17,8 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -public class H5_CreateGroupAbsoluteRelative { - private static String FILENAME = "H5_CreateGroupAbsoluteRelative.h5"; +public class HDF5GroupAbsoluteRelativeCreate { + private static String FILENAME = "HDF5GroupAbsoluteRelativeCreate.h5"; private static String GROUPNAME = "MyGroup"; private static String GROUPNAME_A = "GroupA"; private static String GROUPNAME_B = "GroupB"; @@ -109,6 +109,6 @@ private static void CreateGroupAbsoluteAndRelative() public static void main(String[] args) { - H5_CreateGroupAbsoluteRelative.CreateGroupAbsoluteAndRelative(); + HDF5GroupAbsoluteRelativeCreate.CreateGroupAbsoluteAndRelative(); } } diff --git a/HDF5Examples/JAVA/TUTR/Java_sourcefiles.cmake b/HDF5Examples/JAVA/TUTR/Java_sourcefiles.cmake index e78e12e0e87..a291cf354ad 100644 --- a/HDF5Examples/JAVA/TUTR/Java_sourcefiles.cmake +++ b/HDF5Examples/JAVA/TUTR/Java_sourcefiles.cmake @@ -9,6 +9,7 @@ set (HDF_JAVA_EXAMPLES HDF5DatasetRead.java HDF5GroupDatasetCreate.java HDF5SubsetSelect.java + HDF5GroupAbsoluteRelativeCreate.java ) if (H5_LIBVER_DIR EQUAL 110) set (HDF_JAVA_EXAMPLES ${HDF_JAVA_EXAMPLES} diff --git a/HDF5Examples/JAVA/TUTR/tfiles/110/HDF5GroupAbsoluteRelativeCreate.txt b/HDF5Examples/JAVA/TUTR/tfiles/110/HDF5GroupAbsoluteRelativeCreate.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/doxygen/aliases b/doxygen/aliases index 9e5621a5a08..eb0740abd4e 100644 --- a/doxygen/aliases +++ b/doxygen/aliases @@ -3,18 +3,27 @@ ALIASES += THG="The HDF Group" ################################################################################ # Default URLs (Note that md files do not use any aliases) ################################################################################ +# Default URL for HDF Group Files ALIASES += HDFURL="docs.hdfgroup.org/hdf5" +# URL for archived files ALIASES += ARCURL="docs.hdfgroup.org/archive/support/HDF5/doc" +# URL for RFCs ALIASES += RFCURL="docs.hdfgroup.org/hdf5/rfc" +# URL for documentation ALIASES += DSPURL="portal.hdfgroup.org/display/HDF5" ALIASES += DOCURL="portal.hdfgroup.org/documentation/hdf5-docs" +# URL for downloads ALIASES += DWNURL="portal.hdfgroup.org/downloads" ALIASES += AEXURL="support.hdfgroup.org/ftp/HDF5/examples" # doxygen subdir (develop, v1_14) ALIASES += DOXURL="hdfgroup.github.io/hdf5/v1_14" #branch name (develop, hdf5_1_14) ALIASES += SRCURL="github.com/HDFGroup/hdf5/blob/hdf5_1_14" - +#Other projects that contribute to HDF5 +ALIASES += PRJURL="\HDFURL/projects" +ALIASES += HVURL="github.com/HDFGroup/hdfview/blob/master" +ALIASES += PLURL="github.com/HDFGroup/hdf5_plugins/blob/master" +>>>>>>> e716059... Update doxygen Learn Basics / example refs. Add Reference sections (#4640) ################################################################################ # Styling ################################################################################ diff --git a/doxygen/dox/IntroHDF5.dox b/doxygen/dox/IntroHDF5.dox index 50253ab4573..28c419b0c3b 100644 --- a/doxygen/dox/IntroHDF5.dox +++ b/doxygen/dox/IntroHDF5.dox @@ -298,19 +298,27 @@ hsize_t is used for dimensions Language specific files must be included in applications:
"import h5py / import numpy"
+Python:
+import h5py
+import numpy
+
"#include hdf5.h"
+C:"#include hdf5.h"
"USE HDF5"
and call h5open_f and h5close_f to initialize and close the HDF5 FORTRAN interface
+FORTRAN:USE HDF5
"import hdf.hdf5lib.H5;
- import hdf.hdf5lib.HDF5Constants;"
-
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+
@@ -609,6 +617,7 @@ on the HDF-EOS Tools and Information Center pag
\li \ref LBExamples
\li \ref ExAPI
\li Examples in the Source Code
+\li Other Examples
\section secHDF5ExamplesCompile How To Compile
For information on compiling in C, C++ and Fortran, see: \ref LBCompiling
diff --git a/doxygen/dox/LearnBasics.dox b/doxygen/dox/LearnBasics.dox
index 68700b8df83..ed83b367b6b 100644
--- a/doxygen/dox/LearnBasics.dox
+++ b/doxygen/dox/LearnBasics.dox
@@ -41,7 +41,7 @@ Navigate back: \ref index "Main" / \ref GettingStarted
Navigate back: \ref index "Main" / \ref GettingStarted / \ref LearnBasics
"import h5py / import numpy"
+Python:
+import h5py
+import numpy
+
"#include hdf5.h"
+C:"#include hdf5.h"
"USE HDF5"
and call h5open_f and h5close_f to initialize and close the HDF5 FORTRAN interface
+FORTRAN:USE HDF5
"import hdf.hdf5lib.H5;
- import hdf.hdf5lib.HDF5Constants;"
+Java:
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+
/DS1
dataset in the following file (h5ex_t_objref.h5
) is an Object Reference dataset.
+It contains two references, one to group /G1
and the other to dataset /DS2
:
+\code
+$ h5dump h5ex_t_objref.h5
+HDF5 "h5ex_t_objref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ GROUP "h5ex_t_objref.h5/G1"
+ DATASET "h5ex_t_objref.h5/DS2"
+ DATA {
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE NULL
+ DATA {
+ }
+ }
+ GROUP "G1" {
+ }
+}
+}
+\endcode
+
+\subsubsection subsubsecViewToolsViewDtypes_regref Region Reference
+A Region Reference is a reference to a selection within a dataset. A selection can be either
+individual elements or a hyperslab. In h5dump
you will see the name of the dataset along with
+the elements or slab that is selected. A dataset with a Region Reference datatype consists of
+one or more Region References.
+
+An example of a Region Reference dataset (h5ex_t_regref.h5
) can be found on the
+\ref ExAPI page,
+under Datatypes. If you examine this dataset with h5dump
you will see that /DS1
is a
+Region Reference dataset as indicated by its datatype, highlighted in bold below:
+\code
+$ h5dump h5ex_t_regref.h5
+HDF5 "h5ex_t_regref.h5" {
+GROUP "/" {
+ DATASET "DS1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "h5ex_t_regref.h5/DS2"{
+ REGION_TYPE POINT (0,1), (2,11), (1,0), (2,4)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ DATASET "h5ex_t_regref.h5/DS2" {
+ REGION_TYPE BLOCK (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2),
+ (2,11)-(2,13)
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ }
+ }
+ }
+ DATASET "DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ DATA {
+ (0,0): 84, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119,
+ (0,14): 110, 0,
+ (1,0): 102, 111, 120, 32, 106, 117, 109, 112, 115, 32, 111, 118, 101,
+ (1,13): 114, 32, 0,
+ (2,0): 116, 104, 101, 32, 53, 32, 108, 97, 122, 121, 32, 100, 111, 103,
+ (2,14): 115, 0
+ }
+ }
+}
+}
+\endcode
+
+It contains two Region References:
+\li A selection of four individual elements in dataset /DS2 : (0,1), (2,11), (1,0), (2,4)
+See the #H5Sselect_elements API in the \ref UG for information on selecting individual elements.
+\li A selection of these blocks in dataset /DS2 : (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2), (2,11)-(2,13)
+See the #H5Sselect_hyperslab API in the \ref UG for how to do hyperslab selection.
+
+If you look at the code that creates the dataset (h5ex_t_regref.c
) you will see that the
+first reference is created with these calls:
+\code
+ status = H5Sselect_elements (space, H5S_SELECT_SET, 4, coords[0]);
+ status = H5Rcreate_region(file, DATASET2, space, H5P_DEFAULT, &wdata[0]);
+\endcode
+
+where the buffer containing the coordinates to select is:
+\code
+ coords[4][2] = { {0, 1},
+ {2, 11},
+ {1, 0},
+ {2, 4} },
+\endcode
+
+The second reference is created by calling,
+\code
+ status = H5Sselect_hyperslab (space, H5S_SELECT_SET, start, stride, count, block);
+ status = H5Rcreate_region(file, DATASET2, space, H5P_DEFAULT, &wdata[1]);
+\endcode
+where start, stride, count, and block have these values:
+\code
+ start[2] = {0, 0},
+ stride[2] = {2, 11},
+ count[2] = {2, 2},
+ block[2] = {1, 3};
+\endcode
+
+These start, stride, count, and block values will select the elements shown in bold in the dataset:
+\code
+84 104 101 32 113 117 105 99 107 32 98 114 111 119 110 0
+102 111 120 32 106 117 109 112 115 32 111 118 101 114 32 0
+116 104 101 32 53 32 108 97 122 121 32 100 111 103 115 0
+\endcode
+
+If you use h5dump
to select a subset of dataset
+/DS2
with these start, stride, count, and block values, you will see that the same elements are selected:
+\code
+$ h5dump -d "/DS2" -s "0,0" -S "2,11" -c "2,2" -k "1,3" h5ex_t_regref.h5
+HDF5 "h5ex_t_regref.h5" {
+DATASET "/DS2" {
+ DATATYPE H5T_STD_I8LE
+ DATASPACE SIMPLE { ( 3, 16 ) / ( 3, 16 ) }
+ SUBSET {
+ START ( 0, 0 );
+ STRIDE ( 2, 11 );
+ COUNT ( 2, 2 );
+ BLOCK ( 1, 3 );
+ DATA {
+ (0,0): 84, 104, 101, 114, 111, 119,
+ (2,0): 116, 104, 101, 100, 111, 103
+ }
+ }
+}
+}
+\endcode
+
+NOTE that you must release the references created in the code with the #H5Rdestroy API.
+\code
+ status = H5Rdestroy(&wdata[0]);
+ status = H5Rdestroy(&wdata[1]);
+\endcode
+
+For more information on selections, see the tutorial topic on
+@ref LBDsetSubRW. Also see the
+\ref secViewToolsViewSub tutorial topic on using h5dump
to view a subset.
+
+\subsubsection subsubsecViewToolsViewDtypes_depr_objref Deprecated Object Reference
An Object Reference is a reference to an entire object (dataset, group, or named datatype).
A dataset with an Object Reference datatype consists of one or more Object References.
An Object Reference dataset can be used as an index to an HDF5 file.
@@ -1014,7 +1171,7 @@ GROUP "/" {
}
\endcode
-\subsubsection subsubsecViewToolsViewDtypes_regref Region Reference
+\subsubsection subsubsecViewToolsViewDtypes_depr_regref Deprecated Region Reference
A Region Reference is a reference to a selection within a dataset. A selection can be either
individual elements or a hyperslab. In h5dump
you will see the name of the dataset along with
the elements or slab that is selected. A dataset with a Region Reference datatype consists of
@@ -1057,7 +1214,6 @@ It contains two Region References:
See the #H5Sselect_elements API in the \ref UG for information on selecting individual elements.
\li A selection of these blocks in dataset /DS2 : (0,0)-(0,2), (0,11)-(0,13), (2,0)-(2,2), (2,11)-(2,13)
See the #H5Sselect_hyperslab API in the \ref UG for how to do hyperslab selection.
-
If you look at the code that creates the dataset (h5ex_t_regref.c
) you will see that the
first reference is created with these calls:
diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90
index 0c8b1d84099..dbd1c809bd5 100644
--- a/fortran/src/H5Fff.F90
+++ b/fortran/src/H5Fff.F90
@@ -427,7 +427,7 @@ END SUBROUTINE h5funmount_f
!!
!! \brief Opens HDF5 file.
!!
-!! \param name Name of the file to acecss.
+!! \param name Name of the file to access.
!! \param access_flags File access flags. Allowable values are:
!! \li H5F_ACC_RDWR_F
!! \li H5F_ACC_RDONLY_F
diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h
index 5054178846b..661ca7a2abe 100644
--- a/hl/src/H5DOpublic.h
+++ b/hl/src/H5DOpublic.h
@@ -17,7 +17,7 @@
extern "C" {
#endif
-/** \page H5DO_UG The HDF5 High Level Optimizations
+/** \page H5DO_UG HDF5 High Level Optimizations
* @todo Under Construction
*/
diff --git a/hl/src/H5DSpublic.h b/hl/src/H5DSpublic.h
index edbebdbaf28..4afe51180f9 100644
--- a/hl/src/H5DSpublic.h
+++ b/hl/src/H5DSpublic.h
@@ -30,7 +30,7 @@ typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *vi
extern "C" {
#endif
-/** \page H5DS_UG The HDF5 High Level Dimension Scales
+/** \page H5DS_UG HDF5 High Level Dimension Scales
* @todo Under Construction
*/
diff --git a/hl/src/H5IMpublic.h b/hl/src/H5IMpublic.h
index 0ba9d648cff..bf219b73e46 100644
--- a/hl/src/H5IMpublic.h
+++ b/hl/src/H5IMpublic.h
@@ -17,7 +17,7 @@
extern "C" {
#endif
-/** \page H5IM_UG The HDF5 High Level Images
+/** \page H5IM_UG HDF5 High Level Images
* @todo Under Construction
*/
diff --git a/hl/src/H5LTpublic.h b/hl/src/H5LTpublic.h
index 343f5272453..18f7502209f 100644
--- a/hl/src/H5LTpublic.h
+++ b/hl/src/H5LTpublic.h
@@ -34,7 +34,7 @@ typedef enum H5LT_lang_t {
extern "C" {
#endif
-/** \page H5LT_UG The HDF5 High Level Lite
+/** \page H5LT_UG HDF5 High Level Lite
* @todo Under Construction
*/
diff --git a/hl/src/H5PTpublic.h b/hl/src/H5PTpublic.h
index 3016e77ba60..607e385c5c7 100644
--- a/hl/src/H5PTpublic.h
+++ b/hl/src/H5PTpublic.h
@@ -17,7 +17,7 @@
extern "C" {
#endif
-/** \page H5PT_UG The HDF5 High Level Packet Table
+/** \page H5PT_UG HDF5 High Level Packet Table
* @todo Under Construction
*/
diff --git a/hl/src/H5TBpublic.h b/hl/src/H5TBpublic.h
index 42585cf012f..dbeb330a1db 100644
--- a/hl/src/H5TBpublic.h
+++ b/hl/src/H5TBpublic.h
@@ -17,7 +17,7 @@
extern "C" {
#endif
-/** \page H5TB_UG The HDF5 High Level Table
+/** \page H5TB_UG HDF5 High Level Table
* @todo Under Construction
*/
diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h
index e791f7cf00e..26e748ce1a0 100644
--- a/src/H5Dmodule.h
+++ b/src/H5Dmodule.h
@@ -67,17 +67,21 @@
* The dataset does not have to open to be linked or unlinked.
*
* \subsubsection subsubsec_dataset_intro_obj Object Reference
- * A dataset may be the target of an object reference. The object reference is created by
- * #H5Rcreate with the name of an object which may be a dataset and the reference type
+ * A file, group, dataset, named datatype, or attribute may be the target of an object reference.
+ * The object reference is created by
+ * #H5Rcreate_object with the name of an object which may be a dataset and the reference type
* #H5R_OBJECT. The dataset does not have to be open to create a reference to it.
*
* An object reference may also refer to a region (selection) of a dataset. The reference is created
- * with #H5Rcreate and a reference type of #H5R_DATASET_REGION.
+ * with #H5Rcreate_region.
*
- * An object reference can be accessed by a call to #H5Rdereference. When the reference is to a
- * dataset or dataset region, the #H5Rdereference call returns an identifier to the dataset just as if
+ * An object reference can be accessed by a call to #H5Ropen_object. When the reference is to a
+ * dataset or dataset region, the #H5Ropen_object call returns an identifier to the dataset just as if
* #H5Dopen has been called.
*
+ * The reference buffer from the #H5Rcreate_object call must be released by
+ * using #H5Rdestroy to avoid resource leaks and possible HDF5 library shutdown issues.
+ *
* \subsubsection subsubsec_dataset_intro_attr Adding Attributes
* A dataset may have user-defined attributes which are created with #H5Acreate and accessed
* through the @ref H5A API. To create an attribute for a dataset, the dataset must be open, and the
diff --git a/src/H5ESmodule.h b/src/H5ESmodule.h
index f128feeab0e..f63852db384 100644
--- a/src/H5ESmodule.h
+++ b/src/H5ESmodule.h
@@ -25,7 +25,7 @@
#define H5_MY_PKG H5ES
#define H5_MY_PKG_ERR H5E_EVENTSET
-/** \page H5ES_UG The HDF5 Event Set
+/** \page H5ES_UG HDF5 Event Set
* @todo Under Construction
*
* \section sec_async The HDF5 Event Set Interface
diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h
index 2e7918669b6..c76839e8e28 100644
--- a/src/H5Fmodule.h
+++ b/src/H5Fmodule.h
@@ -25,7 +25,7 @@
#define H5_MY_PKG H5F
#define H5_MY_PKG_ERR H5E_FILE
-/** \page H5F_UG The HDF5 File
+/** \page H5F_UG HDF5 File
*
* \section sec_file The HDF5 File
* \subsection subsec_file_intro Introduction
diff --git a/src/H5Imodule.h b/src/H5Imodule.h
index e6828506d1e..f8924d3df62 100644
--- a/src/H5Imodule.h
+++ b/src/H5Imodule.h
@@ -25,7 +25,7 @@
#define H5_MY_PKG H5I
#define H5_MY_PKG_ERR H5E_ID
-/** \page H5I_UG The HDF5 Identifiers
+/** \page H5I_UG HDF5 Identifiers
* @todo Under Construction
*/
diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h
index 7ab67da8138..f29aa5c50c0 100644
--- a/src/H5Lmodule.h
+++ b/src/H5Lmodule.h
@@ -25,7 +25,7 @@
#define H5_MY_PKG H5L
#define H5_MY_PKG_ERR H5E_LINK
-/** \page H5L_UG The HDF5 Links
+/** \page H5L_UG HDF5 Links
* @todo Under Construction
*/
diff --git a/src/H5Mmodule.h b/src/H5Mmodule.h
index 920ec3d1585..375399751b5 100644
--- a/src/H5Mmodule.h
+++ b/src/H5Mmodule.h
@@ -26,11 +26,11 @@
#define H5_MY_PKG_ERR H5E_MAP
/**
- * \page H5M_UG The HDF5 VOL Data Mapping
+ * \page H5M_UG HDF5 VOL Data Mapping
* \Bold{The HDF5 Data Mapping can only be used with the HDF5 VOL connectors that
* implement map objects.} The native HDF5 library does not support this feature.
*
- * \section sec_map The HDF5 Map Object
+ * \section sec_map HDF5 Map Object
*
* \todo Describe the map life cycle.
*
diff --git a/src/H5Omodule.h b/src/H5Omodule.h
index c3c3496bf32..1c1278a0e8a 100644
--- a/src/H5Omodule.h
+++ b/src/H5Omodule.h
@@ -25,7 +25,7 @@
#define H5_MY_PKG H5O
#define H5_MY_PKG_ERR H5E_OHDR
-/** \page H5O_UG The HDF5 Objects
+/** \page H5O_UG HDF5 Objects
* @todo Under Construction
*/
diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h
index cccdf6ef506..f034e7c6631 100644
--- a/src/H5PLmodule.h
+++ b/src/H5PLmodule.h
@@ -26,7 +26,7 @@
#define H5_MY_PKG H5PL
#define H5_MY_PKG_ERR H5E_PLUGIN
-/** \page H5PL_UG The HDF5 Plugins
+/** \page H5PL_UG HDF5 Plugins
*
* \section sec_filter_plugins HDF5 Filter Plugins
*
diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h
index 5e3affbfabc..443c4746d71 100644
--- a/src/H5Rmodule.h
+++ b/src/H5Rmodule.h
@@ -24,8 +24,372 @@
#define H5_MY_PKG H5R
#define H5_MY_PKG_ERR H5E_REFERENCE
-/** \page H5R_UG The HDF5 References
- * @todo Under Construction
+/** \page H5R_UG HDF5 References
+ *
+ * \section sec_reference HDF5 References
+ * HDF5 references allow users to reference existing HDF5 objects (file, group, dataset, named datatype, or
+ * attribute) as well as selections within datasets.
+ *
+ * The original API, now deprecated, was extended in order to add the ability to reference attributes as well
+ * as objects in external files. Additionally, there were some inherent limitations within the older API that
+ * restricted its use with virtual object layer (VOL) connectors, which do not necessarily follow HDF5’s
+ * native file format.
+ *
+ * The newer API introduced a single opaque reference type, which not only has the advantage of hiding the
+ * internal representation of references, but it also allows for future extensions to be added more
+ * seamlessly.
+ *
+ * \subsection subsec_reference_intro Introduction
+ * The deprecated HDF5 reference API only allowed users to create references to HDF5 objects (groups,
+ * datasets) and regions within a dataset. There were some limitations: it defined two separate reference
+ * types #hobj_ref_t and #hdset_reg_ref_t; the former directly mapped to an #haddr_t type that did not allow
+ * for external references, while the latter mapped to an HDF5 global heap entry, which was specific to native
+ * HDF5 and was created and written to the file when the reference was created. This prevented users from
+ * creating region references when the file is opened read-only, it was also not suitable for use outside of
+ * native HDF5 files. The newer API addressed these limitations by introducing a single abstract #H5R_ref_t
+ * type as well as missing reference types such as attribute references and external references (i.e.,
+ * references to objects in an external file).
+ *
+ * \subsection subsec_reference_dep Deprecated API
+ * There is no support for attribute references; references are only valid within the
+ * container that they reference; the size of the reference types are tied to the definition of an haddr_t or
+ * an entry in the file’s global heap, which only exists in native HDF5.
+ *
+ * \subsubsection subsubsec_reference_limit Limitations
+ * \li The #H5Rcreate signature forces users to constantly pass (#H5I_INVALID_HID) as a space_id, in the case
+ * where the reference type is not a region reference.
+ * \li The size of region
+ * references was defined as the size required to encode a global heap ID, this definition forces
+ * references to be written to the file at the time of their creation, hence preventing them to be created
+ * from a file that is opened read-only (e.g, when creating references to a file that one does not want
+ * to/cannot modify).
+ *
+ * \subsubsection subsubsec_reference_old_API Deprecated Methods
+ * The original API before hdf5 1.12.0 is defined below:
+ * \code
+ * // Deprecated reference buffer sizes that are kept for backward compatibility
+ * #define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
+ * #define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
+ *
+ * // Reference types
+ * typedef enum H5R_type_t {
+ * H5R_BADTYPE = (-1), // Invalid Reference Type
+ * H5R_OBJECT, // Object reference
+ * H5R_DATASET_REGION, // Dataset Region Reference
+ * H5R_MAXTYPE // Highest type (Invalid as true type)
+ * } H5R_type_t;
+ *
+ * // Object reference structure for user's code
+ * // This needs to be large enough to store largest haddr_t on a worst case
+ * // machine (8 bytes currently).
+ * typedef haddr_t hobj_ref_t;
+ *
+ * // Dataset Region reference structure for user's code
+ * // (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
+ * typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE];
+ *
+ * // Prototypes
+ * herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
+ * hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
+ * hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
+ * herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type);
+ * ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name , size_t size);
+ * \endcode
+ *
+ * \subsection subsec_reference_new New API
+ * The current API is defined below:
+ * \code
+ * // Deprecated reference buffer sizes that are kept for backward compatibility
+ * #define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
+ * #define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
+ *
+ * // Default reference buffer size.
+ * #define H5R_REF_BUF_SIZE (64)
+ *
+ * // Reference types allowed.
+ * 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_type_t;
+ *
+ * // Deprecated object reference type that is used with deprecated reference APIs.
+ * // This type can only be used with the "native" HDF5 VOL connector.
+ * typedef haddr_t hobj_ref_t;
+ *
+ * // Deprecated dataset region reference type that is used with deprecated reference APIs.
+ * // 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;
+ *
+ * // Opaque reference type. The same reference type is used for object,
+ * // dataset region and attribute references. This is the type that
+ * // should always be used with the current reference API.
+ * typedef struct {
+ * union {
+ * uint8_t __data[H5R_REF_BUF_SIZE]; // opaque data
+ * int64_t align; // ensures alignment
+ * } u;
+ * } H5R_ref_t;
+ *
+ * // Constructors
+ * herr_t H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr);
+ * herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, H5R_ref_t *ref_ptr);
+ * herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, H5R_ref_t *ref_ptr);
+ * herr_t H5Rdestroy(H5R_ref_t *ref_ptr);
+ *
+ * // Info
+ * H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr);
+ * htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr);
+ * herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr);
+ *
+ * // Dereference
+ * hid_t H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
+ * hid_t H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
+ * hid_t H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id);
+ *
+ * // Get type
+ * herr_t H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type);
+ *
+ * // Get name
+ * ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
+ * ssize_t H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *name, size_t size);
+ * ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
+ * \endcode
+ *
+ * References can be stored and retrieved from a file by invoking the #H5Dwrite and #H5Dread functions
+ * with this single predefined type: #H5T_STD_REF.
+ *
+ * The advantage of a single type is that it becomes easier for users to mix references of different types. It
+ * is also more in line with the opaque type now defined for references. Note that when reading references
+ * back from a file, the library may, in consequence of this new design, allocate memory for each of these
+ * references. To release the memory, one must either call #H5Rdestroy on each of the references or, for
+ * convenience, call the new #H5Treclaim function on the buffer that contains the array of references (type
+ * can be compound type, array).
+ *
+ * As mentioned, instead of having separate routines for both vlen and reference types, we unify the existing:
+ * \code
+ * herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf);
+ * \endcode
+ * to
+ * \code
+ * herr_t H5Treclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf);
+ * \endcode
+ *
+ * \subsection subsec_reference_compat API Compatibility
+ * To preserve compatibility with applications and middleware libraries that have been using the existing
+ * reference API, we keep the existing #H5Rcreate, #H5Rdereference2, #H5Rget_region,
+ * #H5Rget_obj_type2 and #H5Rget_name routines, but moved to the deprecated
+ * API list of functions.
+ *
+ * It is important to note though that these routines only support the original reference types, noted as
+ * #H5R_OBJECT1 and #H5R_DATASET_REGION1 respectively. Any other reference type passed to these routines
+ * will return an error. For convenience and compatibility with previous versions of the library we define
+ * both #H5R_OBJECT and #H5R_DATASET_REGION to map to the original reference types \code
+ * // Versions for compatibility
+ * #define H5R_OBJECT H5R_OBJECT1
+ * #define H5R_DATASET_REGION H5R_DATASET_REGION1
+ * \endcode
+ *
+ * When creating and accessing references through these deprecated routines, users are still expected to use
+ * the datatypes which describe the #hobj_ref_t and #hdset_reg_ref_t types, #H5T_STD_REF_OBJ and
+ * #H5T_STD_REF_DSETREG.
+ *
+ * One important aspect of these changes is to ensure that previously written data can still be readable after
+ * those revisions and that new files produced will not create any undefined behavior when used with previous
+ * versions of the library. Backward as well as forward compatibility is summarized in the table:
+ *
+ * Version | Old File Format/Old API | Old File Format/New API | New File Format/Old + * API | New File Format/New API | + *
---|---|---|---|---|
< 1.12.0 | No change | N/A | Datatype version bump prevents from reading unknown + * reference types | N/A | + *
≥ 1.12.0 | + *Read and write references through old datatypes and use #hobj_ref_t and #hdset_reg_ref_t types | + *Read and write using #H5T_STD_REF to convert to new #H5R_ref_t type | + *Cannot use old API with new reference types | + *Can use opaque #H5R_ref_t type for all reference types | + *