Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672

Include Content
render-without-blockstrue
page.rm-navbar
HTML Wrap
classhdf-print-only

Page Title

HTML Wrap
classhdf-rm-summary-block

Hdf rm anchor
AnchorNamesummary

Excerpt

Sets the callback function that H5O_COPY will invoke before searching the entire destination file for a matching committed datatype

HTML Wrap
classhdf-rm-content-block

Hdf rm anchor
AnchorNameprocedure

Procedure:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf_procedure

H5P_SET_MCDT_SEARCH_CB ( ocpypl_id, func, op_data )

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-c

HTML
<pre><code class="language-c">herr_t H5Pset_mcdt_search_cb(
            hid_t ocpypl_id,
            H5O_mcdt_search_cb_t func,
            void *op_data
        )

  </code></pre>
HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-fortran

HTML
<pre><code class="language-fortran">NONE</code></pre>

Hdf rm anchor
AnchorNameparameters

Parameters:
HTML Wrap
classhdf-rm-section
id_t ocpypl_idIN: Object copy property list identifier
H5O_mcdt_search_cb_t funcIN: User-defined callback function
void *op_dataIN: User-defined input data for the callback function

Hdf rm anchor
AnchorNamedescription

Motivation:
HTML Wrap
classhdf-rm-section

H5P_SET_MCDT_SEARCH_CB provides the means to define a callback function. An application can then use that callback to take an additional action before the default search of all committed datatypes in the destination file or to take an action that replaces the default search. This mechanism is intended to improve performance when the global search might take a long time.

Description:
HTML Wrap
classhdf-rm-section

H5P_SET_MCDT_SEARCH_CB allows an application to set a callback function, func, that will be invoked before searching the destination file for a matching committed datatype. The default, global search process is described in H5P_ADD_MERGE_COMMITTED_DTYPE_PATH.

The callback function must conform to the H5O_mcdtMCDT_searchSEARCH_cbCB_tT prototype and will return an instruction for one of the following actions:

  • Continue the search for a matching committed datatype in the destination file.
  • Discontinue the search for a matching committed datatype. H5O_COPY will then apply the default behavior of creating an anonymous committed datatype.
  • Abort the copy operation and exit H5O_COPY.
Warning

If the callback function return value causes H5O_COPY to abort, the destination file may be left in an inconsistent or corrupted state.

Programming Note for C++ Developers Using C Functions:
HTML Wrap
classhdf-rm-section

If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine should be returned from normally.

Examples of this kind of routine include callbacks such as H5P_SET_ELINK_CB and H5P_SET_TYPE_CONV_CB and functions such as H5T_CONVERT and H5E_WALK2.

Exiting the routine in its normal fashion allows the HDF5 C library to clean up its work properly. In other words, if the C++ application jumps out of the routine back to the C++ “catch” statement, the library is not given the opportunity to close any temporary data structures that were set up when the routine was called. The C++ application should save some state as the routine is started so that any problem that occurs might be diagnosed.

See Also:
HTML Wrap
classhdf-rm-section
Info

Copying Committed Datatypes with H5Ocopy - A comprehensive discussion of copying committed datatypes (PDF) in Advanced Topics in HDF5

Hdf rm anchor
AnchorNamereturns

Returns:
HTML Wrap
classhdf-rm-section

Returns a non-negative value if successful; otherwise returns a negative value.

Failure Modes:
HTML Wrap
classhdf-rm-section

H5P_SET_MCDT_SEARCH_CB will fail if the object copy property list is invalid.

Hdf rm anchor
AnchorNameexample

Example Usage:
HTML Wrap
classhdf-rm-section
This example defines a callback function in the object copy property list.
/* 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 a 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);
    H5Ocopy(...ocpypl_id...);
    ...
    ...
}

 

Comment
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_subset.c
showLineNumberstrue
lineStart32
progLangcpp
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathfortran/examples/compound.f90
showLineNumberstrue
lineStart25
progLangplain
lineEnd35
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

Hdf rm anchor
AnchorNamehistory

History:
HTML Wrap
classhdf-rm-section
Release    Change
1.8.9C function introduced in this release.