herr_t H5Pset_object_flush_cb (
hid_t fapl_id,
H5F_flush_cb_t func,
void *user_data
)
H5Pset_object_flush_cb
sets the callback function to
invoke in the file access property list fapl_id
whenever an object flush occurs in the file. Library objects are
group, dataset, and committed datatype.
The callback function func
must conform to the prototype
defined below:
typedef herr_t
(*H5F_flush_cb_t)(hid_t object_id,
void *user_data)
The parameters of the callback function, per the above prototyps, are defined as follows:
object_id
is the identifier of the object
which has just been flushed.user_data
is the user-defined input data
for the callback function.hid_t fapl_id |
IN: Identifier for a file access property list. |
H5F_flush_cb_t func |
IN: The user-defined callback function. |
void *user_data |
IN: The user-defined input data for the callback function. |
hid_t file_id, fapl_id; hid_t dataset_id, dapl_id; unsigned counter; /* Create a copy of the file access property list * fapl_id = H5Pcreate(H5P_FILE_ACCESS); /* Set up the object flush property values */ /* flush_cb: callback function to invoke when an object flushes (see below) */ /* counter: user data to pass along to the callback function */ H5Pset_object_flush_cb(fapl_id, flush_cb, &counter); /* Open the file */ file_id = H5Fopen(FILE, H5F_ACC_RDWR, H5P_DEFAULT); /* Create a group */ gid = H5Gcreate2(fid, “group”, H5P_DEFAULT, H5P_DEFAULT_H5P_DEFAULT); /* Open a dataset */ dataset_id = H5Dopen2(file_id, DATASET, H5P_DEFAULT); /* The flush will invoke flush_cb() with counter */ H5Dflush(dataset_id); /* counter will be equal to 1 */ : : : /* The flush will invoke flush_cb() with counter */ H5Gflush(gid); /* counter will be equal to 2 */ : : : /* The callback function for object flush property */ static herr_t flush_cb(hid_t obj_id, void *_udata) { unsigned *flush_ct = (unsigned*)_udata; ++(*flush_ct); return 0; }
Release | Change |
1.10.0 | C function introduced with this release. |