summaryrefslogtreecommitdiffstats
path: root/doxygen/examples/H5Pget_object_flush_cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'doxygen/examples/H5Pget_object_flush_cb.c')
-rw-r--r--doxygen/examples/H5Pget_object_flush_cb.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/doxygen/examples/H5Pget_object_flush_cb.c b/doxygen/examples/H5Pget_object_flush_cb.c
new file mode 100644
index 0000000..d18f3df
--- /dev/null
+++ b/doxygen/examples/H5Pget_object_flush_cb.c
@@ -0,0 +1,41 @@
+hid_t fapl_id;
+unsigned counter;
+H5F_object_flush_t *ret_cb;
+unsigned * ret_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);
+
+/* Get the file access property list for the file */
+fapl = H5Fget_access_plist(file_id);
+
+/* Retrieve the object flush property values for the file */
+H5Pget_object_flush_cb(fapl, &ret_cb, &ret_counter);
+/* ret_cb will point to flush_cb() */
+/* ret_counter will point to counter */
+
+/*
+.
+.
+.
+.
+.
+.
+*/
+
+/* The callback function for the object flush property */
+static herr_t
+flush_cb(hid_t obj_id, void *_udata)
+{
+ unsigned *flush_ct = (unsigned *)_udata;
+ ++(*flush_ct);
+ return 0;
+}