Provides the mechanism by which a user application may set an action for H5O_COPY to take after checking all suggested paths for a matching committed datatype but before starting the global search of the destination file



<pre><code class="language-c">typedef H5O_mcdt_search_ret_t ( *H5O_mcdt_search_cb_t )( void *op_data )</code></pre>

void *op_dataIN/OUT: Pointer to user-defined input data. This is a pass-through of the data that was passed to H5P_SET_MCDT_SEARCH_CB.


H5O_MCDT_SEARCH_CB_T is the callback function that H5O_COPY will invoke if the callback is set and when the merge committed datatype feature is enabled in the object copy property list (see H5P_SET_COPY_OBJECT).

After searching the list of suggested committed datatype paths, H5O_COPY will invoke this callback before searching all committed datatypes in the destination file. This allows a user application to add a customized step to the search process. The callback function is set with H5P_SET_MCDT_SEARCH_CB and the search process is described in H5P_ADD_MERGE_COMMITTED_DTYPE_PATH.

Valid return values from this callback function are as follows (defined in the enumerated datatype H5O_mcdt_search_ret_t in H5Opublic.h):

H5O_MCDT_SEARCH_CONTContinues the global search of all committed datatypes in the destination file
H5O_MCDT_SEARCH_STOPStops the search, but continues copying

If the callback’s return value is H5O_MCDT_SEARCH_ERROR, H5O_COPY will abort and the destination file may be left in an inconsistent or corrupted state.


Returns one of the H5O_MCDT_SEARCH_* values described above.

Failure Modes:

H5O_MCDT_SEARCH_CB_T failure modes are dependent on the implementation of the callback function.


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);


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. */

Release    Change
1.8.9C function type introduced in this release.