diff options
author | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2014-11-11 17:01:20 (GMT) |
---|---|---|
committer | Jerome Soumagne <jsoumagne@hdfgroup.org> | 2016-11-29 23:42:29 (GMT) |
commit | ef2392520715baa24be706fb6416a5079aa81c4b (patch) | |
tree | 819f8b3c032ad650e9d3b79e70275d0bb1bd8f03 | |
parent | 48d0130ec9babe15cce2e9dbbde79e7ec0440e4d (diff) | |
download | hdf5-ef2392520715baa24be706fb6416a5079aa81c4b.zip hdf5-ef2392520715baa24be706fb6416a5079aa81c4b.tar.gz hdf5-ef2392520715baa24be706fb6416a5079aa81c4b.tar.bz2 |
Add H5Pget/set_index_read_on_create routines for XCPL property
Add read on create XCPL property
-rw-r--r-- | src/H5Ppublic.h | 4 | ||||
-rw-r--r-- | src/H5Pxcpl.c | 86 |
2 files changed, 90 insertions, 0 deletions
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 95714ac..20a35b2 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -487,6 +487,10 @@ 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); H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data); +/* Index creation property list (XCPL) routines */ +H5_DLL herr_t H5Pset_index_read_on_create(hid_t plist_id, hbool_t value); +H5_DLL herr_t H5Pget_index_read_on_create(hid_t plist_id, hbool_t *value); + /* Symbols defined for compatibility with previous versions of the HDF5 API. * * Use of these symbols is deprecated. diff --git a/src/H5Pxcpl.c b/src/H5Pxcpl.c index bb76352..4e96f2b 100644 --- a/src/H5Pxcpl.c +++ b/src/H5Pxcpl.c @@ -45,6 +45,12 @@ /****************/ /* ======== Index creation properties ======== */ +/* Definitions for index plugin value */ +#define H5X_CRT_READ_ON_CREATE_SIZE sizeof(hbool_t) +#define H5X_CRT_READ_ON_CREATE_DEF TRUE +#define H5X_CRT_READ_ON_CREATE_ENC H5P__encode_hbool_t +#define H5X_CRT_READ_ON_CREATE_DEC H5P__decode_hbool_t + /******************/ /* Local Typedefs */ @@ -93,6 +99,10 @@ const H5P_libclass_t H5P_CLS_XCRT[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const hbool_t H5X_def_read_on_create_g = H5X_CRT_READ_ON_CREATE_DEF; /* Default read on create value */ + + /*------------------------------------------------------------------------- * Function: H5P__xcrt_reg_prop @@ -110,6 +120,82 @@ H5P__xcrt_reg_prop(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI(FAIL) + /* Register the "read data on create" property */ + if(H5P_register_real(pclass, H5X_CRT_READ_ON_CREATE_NAME, + H5X_CRT_READ_ON_CREATE_SIZE, &H5X_def_read_on_create_g, + NULL, NULL, NULL, H5X_CRT_READ_ON_CREATE_ENC, + H5X_CRT_READ_ON_CREATE_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__xcrt_reg_prop() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_index_read_on_create + * + * Purpose: Set index to read data when created. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_index_read_on_create(hid_t plist_id, hbool_t value) +{ + H5P_genplist_t *plist; /* Property list pointer */ + hbool_t read_on_create; /* Value property to modify */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + + /* Get the property list structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_INDEX_CREATE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + read_on_create = value; + + /* Set values */ + if(H5P_set(plist, H5X_CRT_READ_ON_CREATE_NAME, &read_on_create) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set property value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_index_read_on_create() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_index_read_on_create + * + * Purpose: Get boolean to read data on index creation. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_index_read_on_create(hid_t plist_id, hbool_t *value/*out*/) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + + /* Set values */ + if(value) { + H5P_genplist_t *plist; /* Property list pointer */ + hbool_t read_on_create; /* Value property to query */ + + /* Get the property list structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_INDEX_CREATE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Retrieve fill value settings */ + if(H5P_get(plist, H5X_CRT_READ_ON_CREATE_NAME, &read_on_create) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value") + + /* Set user's value */ + *value = read_on_create; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_index_read_on_create() */ |