summaryrefslogtreecommitdiffstats
path: root/doxygen/examples/H5TBAget_fill.c
diff options
context:
space:
mode:
authorvchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com>2022-07-01 15:42:15 (GMT)
committerGitHub <noreply@github.com>2022-07-01 15:42:15 (GMT)
commit9e97a22b8bb7cc92f0b2ef2b63de61e9da50aba6 (patch)
tree8921d2c772d5616a1251b312663a97f5d0513406 /doxygen/examples/H5TBAget_fill.c
parent3ed53d17fb018c0415be2d668c6765217deff16f (diff)
downloadhdf5-9e97a22b8bb7cc92f0b2ef2b63de61e9da50aba6.zip
hdf5-9e97a22b8bb7cc92f0b2ef2b63de61e9da50aba6.tar.gz
hdf5-9e97a22b8bb7cc92f0b2ef2b63de61e9da50aba6.tar.bz2
Add doxygen for high level modules. (#1839)
* Add doxygen for high level modules. * Committing clang-format changes * Correct spelling based on spelling check. * Committing clang-format changes Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'doxygen/examples/H5TBAget_fill.c')
-rw-r--r--doxygen/examples/H5TBAget_fill.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/doxygen/examples/H5TBAget_fill.c b/doxygen/examples/H5TBAget_fill.c
new file mode 100644
index 0000000..15eae8b
--- /dev/null
+++ b/doxygen/examples/H5TBAget_fill.c
@@ -0,0 +1,43 @@
+unsigned char tmp_fill_buf[40];
+...
+
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+dataset_id = H5Dopen(file_id, TABLE_NAME, H5P_DEFAULT);
+datatype_id = H5Dget_type(dataset_id);
+
+status = H5TBget_table_info(file_id, TABLE_NAME, &nfields, &nrecords);
+
+hasfill = H5TBAget_fill(file_id, TABLE_NAME, dataset_id, tmp_fill_buf);
+
+for (i = 0; i < nfields; i++) {
+ member_type_id = H5Tget_member_type(datatype_id, (unsigned)i);
+ native_mem_type_id = H5Tget_native_type(member_type_id, H5T_DIR_ASCEND);
+ member_offset = H5Tget_member_offset(datatype_id, (unsigned)i);
+ printf("member_offset: %i\n", member_offset);
+ memb_class = H5Tget_class(member_type_id);
+ switch (memb_class) {
+ case H5T_INTEGER:
+ /* convert unsigned char array to integer */
+ break;
+ case H5T_FLOAT:
+ /* convert unsigned char array to double or float */
+
+ if (H5Tequal(native_mem_type_id, H5T_NATIVE_DOUBLE)) {
+ }
+ else if (H5Tequal(native_mem_type_id, H5T_NATIVE_FLOAT)) {
+ f.i = tmp_fill_buf[member_offset] | (tmp_fill_buf[member_offset + 1] << 8) |
+ (tmp_fill_buf[member_offset + 2] << 16) | (tmp_fill_buf[member_offset + 3] << 24);
+ printf("Field %i Fill Value: %lf\n", i, f.f);
+ }
+ break;
+
+ case H5T_STRING:
+ /* convert unsigned char array to string */
+ strsize = H5Tget_size(member_type_id);
+
+ printf("Field %i Fill Value: ", i);
+ for (j = 0; j < strsize; j++)
+ printf("%c", tmp_fill_buf[member_offset + j]);
+ printf("\n");
+ break;
+ }