The example below illustrates the usage of this public routine to obtain the append values that are set up in the dataset access property list.hid_t file_id;
hid_t dapl_id, dataset_id, dapl;
hsize_t dims[2] = {0, 100};
hsize_t max_dims[2] = {H5S_UNLIMITED, 100};
hsize_t boundary_dims[2] = {5, 0};
int counter;
hsize_t ret_boundary[1];
H5D_append_flush_cb_t ret_cb;
void *ret_udata;
/* Open the file */
file_id = H5Fopen(FILE, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, H5P_DEFAULT);
/* Create a copy of the dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
/* Set up the append property values */
/* boundary_dims[0]=5: to invoke callback and flush every 5 lines */
/* boundary_dims[1]=0: no boundary is set for the non-extendible dimension */
/* append_cb: callback function to invoke when hitting boundary (see below) */
/* counter: user data to pass along to the callback function */
H5Pset_append_flush(dapl_id, 2, boundary_dims, append_cb, &counter);
/* DATASET is a 2-dimensional chunked dataset with dataspace:
dims[] and max_dims[] */
dataset_id = H5Dopen2(file_id, “dataset”, dapl_id);
/* Get the dataset access property list for DATASET */
dapl = H5Dget_access_plist(dataset_id);
/* Retrieve the append property values for the dataset */
/* Only 1 boundary size is retrieved: ret_boundary[0] is 5 */
/* ret_cb will point to append_cb() */
/* ret_udata will point to counter */
H5Pget_append_flush(dapl, 1, ret_boundary, &ret_cb, &ret_udata);
:
:
:
/* The callback function */
static herr_t
append_cb(hid_t dset_id, hsize_t *cur_dims, void *_udata)
{
unsigned *count = (unsigned *)_udata;
++(*count++);
return 0;
} /* append_cb() */
Comment |
---|
HTML Wrap |
---|
| Bitbucket Server file |
---|
repoSlug | hdf5 |
---|
branchId | refs/heads/1.10/master |
---|
projectKey | HDFFV |
---|
filepath | examples/h5_subset.c |
---|
showLineNumbers | true |
---|
lineStart | 32 |
---|
progLang | cpp |
---|
lineEnd | 42 |
---|
applicationLink | 5ac7b370-7412-3c8c-ad20-807a68261336 |
---|
|
|
HTML Wrap |
---|
class | hdf-togglebox hdf-fortran hdf-togglebox-hidden |
---|
| Bitbucket Server file |
---|
repoSlug | hdf5 |
---|
branchId | refs/heads/1.10/master |
---|
projectKey | HDFFV |
---|
filepath | fortran/examples/compound.f90 |
---|
showLineNumbers | true |
---|
lineStart | 25 |
---|
progLang | plain |
---|
lineEnd | 35 |
---|
applicationLink | 5ac7b370-7412-3c8c-ad20-807a68261336 |
---|
|
|
|
|