summaryrefslogtreecommitdiffstats
path: root/doxygen/examples/H5Pset_object_flush_cb.c
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-05-04 22:46:10 (GMT)
committerGitHub <noreply@github.com>2021-05-04 22:46:10 (GMT)
commit021d7c7278fd9c182802f2d5419438716beb37bc (patch)
tree772b610158e3c771e575a5d7095ebfa589480240 /doxygen/examples/H5Pset_object_flush_cb.c
parent0801e83615713d95174ed936462310cea32328c7 (diff)
downloadhdf5-021d7c7278fd9c182802f2d5419438716beb37bc.zip
hdf5-021d7c7278fd9c182802f2d5419438716beb37bc.tar.gz
hdf5-021d7c7278fd9c182802f2d5419438716beb37bc.tar.bz2
Hdf5 1 12 doxygen merge (#615)
* OESS-98 fix tools test for plugins * sync fork * Merge of changes from dev * Move problem option to bottom of the list until fixed * HDFFV-11106 - fix parsing optional args * HDFFV-11106 add note * grammer fix * Whitespace after clang formatting * Undo format version 11 changes * Update check to working version * Merge workflow and minor changes from develop * Update supported platforms * PR#3 merge from develop * Merge gcc 10 diagnostics option from develop * Merge #318 OSX changes from develop * Merge serval small changes from dev * fix typo * Minor non-space formatting changes * GH #386 copyright corrections for java folder * revert because logic requires false return * Merges from develop #358 patches from vtk #361 fix header guard spelling * Remove case statement for H5I_EVENTSET * Correct call with versioning * Remove tabs * Double underscore change * Merges from develop #340 clang -Wformat-security warnings #360 Fixed uninitialized warnings Remove more underscores from header guards * Merge #380 from develop * Correct date entry * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes * Some Javadoc warning fixes * Committing clang-format changes * Updated javadoc fixes * HDFFV-11228/9 merges from develop * remove obsolete debug comment * Fix conflict * HDFFV-11229 merge changes from develop * HDFFV-11229 merge second compare from develop * HDFFV-11229 fix reference file * HDFFV-11229 update autotools test script for two ref files * HDFFV-11229 merge dev changes for long double display in tools * Committing clang-format changes * Update with changes from develop * Add "option" command for clang options * Rework CMake add_custom to use the BYPRODUCTS argument Update pkgconfig scripts for parallel builds. Fix install COPYING file reference. Remove unused round defines. Change CMake default setting of BUILD_CPP to off. * Whitespace changes * Rework CMake add_custom to use the BYPRODUCTS argument * Revert CMake configure checks for round defines * With VS 2015 minimum strdup is supported * Doxygen comments merged from develop * doxygen build updates * Correct version string for map functions Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'doxygen/examples/H5Pset_object_flush_cb.c')
-rw-r--r--doxygen/examples/H5Pset_object_flush_cb.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/doxygen/examples/H5Pset_object_flush_cb.c b/doxygen/examples/H5Pset_object_flush_cb.c
new file mode 100644
index 0000000..1dfa90d
--- /dev/null
+++ b/doxygen/examples/H5Pset_object_flush_cb.c
@@ -0,0 +1,41 @@
+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;
+}