This example defines a callback function in the object copy property list to discontinue the global search if a matching committed datatype cannot be found among the suggested paths. /* The user-defined callback function */
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);
/* Enable the merging committed datatype feature. */
H5Pset_copy_object(ocpypl_id, H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG);
/* Add the path to search for a matching committed datatype. */
H5Padd_merge_committed_dtype_path(ocpypl_id, "/group/committed_dtypeA");
/*
* Set the callback function to discontinue the global search
* if H5Ocopy cannot find a matching committed datatype from the
* above suggested path.
*/
action = H5O_MCDT_SEARCH_STOP;
H5Pset_mcdt_search_cb(ocpypl_id, mcdt_search_cb, &action);
/* Do the copy. */
H5Ocopy(...ocpypl_id...);
...
...
} |