summaryrefslogtreecommitdiffstats
path: root/src/H5Tpkg.h
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2024-03-12 10:42:32 (GMT)
committerGitHub <noreply@github.com>2024-03-12 10:42:32 (GMT)
commit4b297e986c6d53224c305b42acbbebcff4eade63 (patch)
tree6652e7c2d22d64f033bbbca46b821f399f2fad2e /src/H5Tpkg.h
parentfd280df53a17ba7de1e81f2f439de5169a178baa (diff)
downloadhdf5-4b297e986c6d53224c305b42acbbebcff4eade63.zip
hdf5-4b297e986c6d53224c305b42acbbebcff4eade63.tar.gz
hdf5-4b297e986c6d53224c305b42acbbebcff4eade63.tar.bz2
Implement ID creation optimization for container datatype conversions (#4113)
Makes the datatype conversion context object available during both the initialization and conversion processes for a datatype conversion function, allowing the compound, variable-length and array datatype conversion functions to avoid creating IDs for the datatypes when they aren't necessary Adds internal H5CX_pushed routine to determine if an API context is available to retrieve values from Also adds error checking to several places in H5T.c and H5Tconv.c where the code had previously assumed object close operations would succeed
Diffstat (limited to 'src/H5Tpkg.h')
-rw-r--r--src/H5Tpkg.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 97e39b2..ddca0b3 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -152,17 +152,35 @@ struct H5T_stats_t {
/* Context struct for information used during datatype conversions */
typedef struct H5T_conv_ctx_t {
- H5T_conv_cb_t cb_struct;
- hid_t dxpl_id;
- hid_t src_type_id;
- hid_t dst_type_id;
+ union {
+ /*
+ * Fields only valid during conversion function initialization
+ * (H5T_cmd_t H5T_CONV_INIT)
+ */
+ struct H5T_conv_ctx_init_fields {
+ H5T_conv_cb_t cb_struct;
+ } init;
+
+ /*
+ * Fields only valid during conversion function conversion
+ * process (H5T_cmd_t H5T_CONV_CONV)
+ */
+ struct H5T_conv_ctx_conv_fields {
+ H5T_conv_cb_t cb_struct;
+ hid_t dxpl_id;
+ hid_t src_type_id;
+ hid_t dst_type_id;
+ } conv;
+
+ /* No fields currently defined for H5T_cmd_t H5T_CONV_FREE */
+ } u;
} H5T_conv_ctx_t;
/* Library internal datatype conversion functions are... */
typedef herr_t (*H5T_lib_conv_t)(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata, const H5T_conv_ctx_t *conv_ctx,
size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg);
-/* Conversion callbacks (library internal ones don't need DXPL) */
+/* Conversion callbacks */
typedef struct H5T_conv_func_t {
bool is_app; /* Whether conversion function is registered from application */
union {